A JavaScript program is a sequence of statements.
Each statement is an instruction for the computer to do something.
vs.
An expression is a bit of JavaScript code that produces a value.
1 → produces 1
"hello" → produces "hello"
5 * 10 → produces 50
num > 100 → produces either true or false
isHappy ? "🙂" : "🙁" → produces an emoji
[1, 2, 3].pop() → produces the number 3
https://www.joshwcomeau.com/javascript/statements-vs-expressions/
'Programming > JavaScript' 카테고리의 다른 글
Coding Challenge #4 - tip calculator using ternary operator (0) | 2022.08.30 |
---|---|
The Conditional (Ternary) Operator (0) | 2022.08.30 |
Coding Challenge #3 - Compare the team's average scores using if / else statements (0) | 2022.08.25 |
The switch Statement (0) | 2022.08.25 |
Truthy and Falsy Values (0) | 2022.08.21 |