Basic syntax
A JavaScript program is a list of statements (instructions) that the engine executes from top to bottom, one after another.
The semicolon
Each statement can end with ;. JavaScript sometimes inserts it for you,
but getting into the habit of adding it prevents subtle bugs:
let age = 30;
console.log(age);
Comments
Comments are text that the engine ignores. They're used to explain the code to other people (and to your future self!):
// This is a single-line comment
/*
This is a comment
spanning multiple lines
*/
Case matters
JavaScript is case-sensitive: age, Age, and AGE
are three different names.
Examples
Comments and multiple statements
// Calculate the area of a rectangle
let base = 5;
let height = 3;
let area = base * height; // base times height
console.log("The area is", area);