JS-017
Statement explained in a JavaScript learning illustration — Does something
Beginner3 min~3 min read#statement#syntax#execution

Statement

Does something

Goal

Understand what a statement is and how it differs from an expression.

Explanation

  • A statement is a command that JavaScript executes.
  • Unlike an expression, a statement does not necessarily return a value.
  • Its job is to perform a specific action.
  • For example, declare a variable, print information to the console, or run a condition.
  • A program consists of many statements that run one after another.

Analogy

An expression is like a calculator's answer. A statement is like pressing a button that triggers a specific action.

Code

let age = 25;

console.log(age);

Result: 25

Common mistake

Beginners often confuse expressions and statements. An expression produces a value; a statement performs an action.

Remember

  • A statement performs an action.
  • A program is made of statements.
  • An expression creates a value; a statement uses it.

Quick Quiz

What does a statement do?

Resources