Expression

A small piece of code that, when executed, produces a value.

What is an expression?

An expression is a small piece of code that produces a value. But without another expression the result is usually meaningless. You generally combine multiple expressions to create a statement.

// examples of 3 different expressions
13 + 4 * 2 - 7

// expressions are evaluated in this order
4 * 2  // first
13 + 8 // second
21 - 7 // third

// this statement performs the arithmetic
// and stores the value
let calculation = 13 + 4 * 2 - 7

Level: Novice · More General terms at this level

Updated