Values, Variables and Operators
- Values. Everything a program works with: a number, a piece of text, a yes-or-no: is a value.
- Variables. A variable is a named box for a value; let makes one you can change, const one you cannot reassign.
- Operators. An operator like + or > combines values into a new value, following the same precedence rules as arithmetic.
Expressions and Basic Types
- Expressions. Any piece of code that produces a value is an expression: 2 + 3, name.length, even a function call.
- Numbers and strings. JavaScript keeps one number type for 3 and 3.5 alike, and a string type for text wrapped in quotes.
- Booleans. A boolean is one of exactly two values, true or false: the type every decision in a program stands on.
Reading and Writing JavaScript
- Statements. A program is a list of statements: complete instructions, usually one per line, executed in order.
- Comments. A comment starts with two slashes and is ignored by the engine: it exists only for the humans reading.
- Naming well. Good names carry meaning: totalPrice tells the next reader what the value is, x makes them go hunting.
Before and after this level
- Before: Start Here: How JavaScript Runs: JavaScript in Browsers, Servers and Applications, Source Code, Runtime and Execution.
- Next: Level 2: Program Flow: Conditions and Boolean Logic, Loops and Iteration, Control Flow and Program Decisions.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does JavaScript Level 1: JavaScript Foundations cover?
Values, Variables and Operators, Expressions and Basic Types, Reading and Writing JavaScript: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Start Here: How JavaScript Runs, which covers JavaScript in Browsers, Servers and Applications, Source Code, Runtime and Execution.