📘 How does JavaScript run in the page?
JavaScript defines seven primitive types: string, number, bigint, boolean, undefined, symbol, and null. A primitive is an immutable value that is not an
What you’ll learn
- Values, Types, and VariablesIdentify JavaScript's primitive types and declare variables correctly using let, const, and var.JavaScript has seven primitive types plus the object type, and `typeof` reports a value's type at runtime (with the historical quirk that `typeof null` is "object"). All ordinary numbers share one IEEE 754 double-precision Number type, so there is no separate integer type. Declare bindings with `const` by default and `let` when reassignment is needed; avoid `var`, whose function scope and hoisting behavior cause subtle bugs.
- Operators, Coercion, and EqualityPredict the result of JavaScript expressions involving type coercion and choose strict equality appropriately.JavaScript automatically converts (coerces) values between types in many expressions, which makes `+` overload between addition and string concatenation and makes loose equality (`==`) surprising. Strict equality (`===`) compares without conversion and is the default professionals use; loose equality applies a complex set of conversion rules. Truthiness rules and short-circuiting logical operators let you write concise conditionals once you know which values are falsy.
- Control Flow and FunctionsDirect program execution with conditionals and loops and package reusable logic into functions.Control-flow statements (`if`/`else`, `switch`) and loops (`for`, `while`, `for...of`) decide which code runs and how often. Functions package logic for reuse and can be written as declarations, expressions, or arrow functions, each differing in hoisting and `this` behavior. Parameters can have default values and collect extra arguments with rest syntax, and a function's scope plus closures determine which variables it can access.
- Arrays, Objects, and Iteration MethodsModel data with arrays and objects and transform it using core iteration methods.Arrays are ordered, zero-indexed lists and objects are unordered collections of key-value pairs; together they model most application data. Higher-order array methods like `map`, `filter`, `reduce`, and `forEach` express transformations declaratively by passing a callback. Destructuring and the spread operator let you extract and copy data concisely, and JSON provides a text format for serializing objects and arrays.
- Building the Artifact: An Interactive DOM Mini-AppCombine selection, events, and state updates to build a small interactive web page with JavaScript.This capstone connects JavaScript to a web page through the Document Object Model (DOM), the live tree of nodes the browser builds from HTML. You select elements with `querySelector`, respond to user actions with `addEventListener`, and update the page by changing text, attributes, and classes. The lesson walks through building a tiny interactive artifact, such as a click counter or to-do list, that holds state in a variable and re-renders the DOM whenever that state changes.
Questions this course answers
How many primitive types does JavaScript define?
Per MDN, JavaScript has seven primitive types: string, number, bigint, boolean, undefined, symbol, and null. Everything else is an object.
What does `typeof null` evaluate to?
Due to a long-standing quirk in the language, `typeof null` returns "object". To detect null you must compare with `=== null`.
Which statement about `const` is correct?
const prevents reassigning the binding itself, but it does not freeze the value; you can still mutate properties of an object held in a const variable. It is block-scoped, not function-scoped.
Accessing a `let` variable before its declaration line within the same block produces what?
let and const are not readable until their declaration executes; reading them earlier in the block (the temporal dead zone) throws a ReferenceError, unlike var which yields undefined.
What is the result of the expression `"1" + 2`?
Because one operand of + is a string, the number 2 is coerced to the string "2" and the two are concatenated, producing the string "12".
Which comparison evaluates to `false`?
Strict equality (===) returns false when the operand types differ, and number 0 and string "" are different types. The other three use loose equality (==), which coerces and returns true.
Grounded in trusted sources
- MDN Web Docs, JavaScript Guide, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
- ECMA-262 ECMAScript Language Specification — values and equality
- Marijn Haverbeke, Eloquent JavaScript — fundamentals and DOM
- You Don’t Know JS (Kyle Simpson) — types and coercion
- WHATWG DOM Standard — nodes and events overview
Every Wunder lesson is built from real, reputable sources — never invented.
Related courses
Wunder is a personalized learn-anything platform — tell it any topic and it builds a beautiful, fact-checked course in minutes, with narration, a knowledge check, and a college-style University track.
© 2026 Wunder Learning LLC · Terms & Privacy