JavaScript Chapter 2

Finally figured out how to add a greeting that changes depending on the time to my portfolio website! Check it out:

I did this by using the .getElementById and .textContent methods to replace the text I had in my original sans-JS greeting. Pretty proud to have incorporated my first JS code into an actual project.


A script is a series of instructions.

A statement is a set of instructions that ends with a semicolon.

Statements can be organized into code blocks which begin and end with curly braces.

You can make comments in JS with // (for single-line comments) and /* Blablah*/ (for multi-line comments)

Comments make your code easier to read.

Variables store information a script needs.

You declare a variable with the var keyword.

Use camelCase for naming variables.

Data Types (covered so far): 

Numbers: 1,2,3

Strings: “HI”, “1”, “July”

Booleans: true or false.

Arrays: [“one”, “two”, “three”], [1, 2, 3]

You can do math with operators.


Leave a Reply

Your email address will not be published. Required fields are marked *