bhylu.com

Advertisements

JS Statements

Statements control execution or declare bindings. Expressions produce values that statements can use.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

let total = 0;
for (const price of [3, 5]) {
  total += price;
}
console.log(total);

What happens

A declaration, loop, assignment, and call combine to produce 8.