Data Types
JavaScript's core types: string (text, in quotes),
number (JavaScript uses one type for both whole numbers
and decimals — no separate "integer" type), boolean
(true or false), array (an
ordered list), and object (key/value pairs).
Example: checking a value's type
const text = "hello";
const count = 42;
const isReady = true;
document.getElementById("output").textContent =
typeof text + ", " + typeof count + ", " + typeof isReady;
typeof tells you a value's type at runtime — genuinely
useful when a value's type isn't obvious just from reading the code, like
data that just arrived from an API response. Try changing
count to a string like "42" in the editor and
notice how typeof now reports "string" — a
subtle but real difference that trips up a lot of beginners comparing
"42" to 42 later on.