Lesson 2 of 10

JavaScript Foundations

Lesson 2: Variables and Types

Now we store real values in variables and print them clearly.

Learning Goals

Example

When we write this, we mean each variable stores one piece of information.

// Save as lesson2.js
let internName = "Patricia";
let week = 1;
let isPresent = true;

week = week + 1;

console.log(internName);
console.log(week);
console.log(isPresent);
console.log(typeof internName);
console.log(typeof week);
Keep it simple: use only let for now in this track.
Tip: Run node lesson2.js in your terminal.

Practice

  1. Create a variable for your school name.
  2. Create a variable for your age and add 1.
  3. Create a true/false variable for isMorning.
← Previous Lesson Next Lesson →