Notes
Each of the following codes is a statement in JavaScript:
let x;
x = 5;
let y;
y = 6;
JavaScript statements includes values, operators, expressions, keywords and comments.
keyword:
let
variable:
x;
operator:
+
expression:
x = 2;
comment:
// x = 2; is an expression
We use semicolon(;) to separate JavaScript statements. Semicolon is not required.
//Declare 2 variables
let x,y;
//Assign values to x and y
x=2;
y=7;
Multiple statements on the same line needs to be separated by semicolons.
a=2; b=3; c=4;