undefined
A missing value produced by JavaScript in many default situations.
Primitive values are the simple immutable values of JavaScript: null, undefined, boolean, number, bigint, string and symbol.
const name = "User A"; // string
const tasks = 4; // number
const paid = false; // boolean
const id = Symbol("id"); // symbol
Values & Types
JavaScript has primitive values and objects. Primitive values are not objects, cannot be mutated directly and are represented as direct language values.
The primitive types are null, undefined, boolean, number, bigint, string and symbol. Everything else is object-like, including arrays, dates, regular expressions and functions.
Primitives can feel object-like because JavaScript temporarily wraps many primitive values when you call methods. That is why "hello".toUpperCase() works even though strings are primitive.
A missing value produced by JavaScript in many default situations.
An intentional empty value, often used to say no object or no selected value.
Numbers handle general numeric work. BigInt handles very large integers.
Text, true/false logic and unique property keys.
Examples
const userName = "User A";
const itemCount = 4;
const hasPaid = false;
const selectedOption = null;
const databaseId = 9007199254740993n;
const privateKey = Symbol("record-id");
const itemCount = "4"; const hasPaid = "false"; const selectedOption = ""; // These look simple, but every later calculation must guess intent.
Rules that matter
JavaScript lets values move flexibly, but professional code keeps meaning clear. Convert at boundaries, validate input and choose values that represent the real idea.
Do not store structured data as one long string if an object or array would be clearer.
Avoid "yes", "no", "true" and "false" strings when the value is logical.
Prices, counters and measurements usually start as number values.
BigInt cannot represent fractions and cannot be freely mixed with number arithmetic.
null should mean explicitly empty, not accidentally missing.
Symbols are useful for unique keys and advanced object protocols.
Production thinking
Types are meaning. If the type matches the real concept, the code becomes easier to read and harder to misuse.
Primitive state often controls labels, validation messages and disabled states. Wrong types can create wrong feedback.
Production data should be normalized at boundaries: form input is text, JSON has limits and databases may return strings for large numbers.
Type mistakes in rendering code can show wrong content, empty values or broken template output.
Live code lab
The preview runs inside an isolated iframe. The JavaScript is placed inside the HTML editor for now, so every example stays together and remains easy to understand.
Mini assignment
Practice assignment
Try it yourself
Self-check
Say the answer in plain language. If you can explain the value behavior, the code becomes much easier to debug.