Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Statements and Expressions in JS

// Statements
let x = 0;
function add(a, b) { return a + b; }
if (true) { console.log('Hi'); }

// Expressions
x;          // Resolves to 0
3 + x;      // Resolves to 3
add(1, 2);  // Resolves to 3
Source by www.30secondsofcode.org #
 
PREVIOUS NEXT
Tagged: #Statements #Expressions #JS
ADD COMMENT
Topic
Name
7+9 =