Guided Notes

Variables & Data Types

let, const, and var; strings, numbers, booleans, null, undefined, and objects; typeof and type conversion.

Declaring variables

Slide 1 / 5

A variable is a named container for a value:

let score = 0; // can be reassigned const siteName = 'Aicloud'; // can't be reassigned var old = true; // the pre-2015 way β€” avoid

Rule of thumb: use const by default, let when the value must change, and never var.

Names can contain letters, digits, _ and $, can't start with a digit, and are case-sensitive (score and Score are different). The convention is camelCase: totalPrice.

← Introduction to JavaScript