1.2 - Variables


Web browsers can run a scripting language called JavaScript. The syntax is very similar to C, C++, C#, Java, etc...

Last class we learned about something called the console.


Variables hold data in the memory of the computer.

let w = 2;

let apples = 7;

let myList = w + apples;  // sets the variable 'myList' to 9

console.log(myList);      // output the value of 'myList'

Note - you might see the keyword var being used online instead of let. You should always use let when creating a variable.

Variables can be different types of data:

let myNumber = -45;
let myString = "Some text, in quotes";
let myBoolean = true;   // or false



(Tutorial on variables) (w3schools reference)