Expressions vs. Statements
Expressions
Primary Expression - a single value
let total = 0;
'hello world'; // A string literal
23; // A numeric literal
true; // Boolean value true
total; // Value of variable total
this; // A keyword that evaluates to the current object
add(1,2); // A function call resultArithmetic Expression - an arithmetic operation that evaluates to a numeric value
// 10 + 3 is evaluated by the JS Engine to return the value 13
> 10 + 3;
13
// 10 * 3 is evaluated by the JS Engine to return the value 30
// which is then passed as the argument to the console.log method
console.log(10*3); // 30
String Expressions - evaluate to a string
Logical Expressions - evaluate to true of false (boolean values)
Left-hand Side Expressions - anything that can be assigned a value
Assignment Expression
Statements
Declarative
Expression Statements
Conditional Statements
Last updated