The data types you'll meet
Every value in is one of a small set of types. Knowing them lets you spot when a value is the wrong kind — a frequent source of bugs.
- string — text, always in double quotes:
"Ada Lovelace","[email protected]". - number — a plain number, no quotes:
42,3.14. (Quotes change the meaning:"42"is the text four-two, not the number.) - boolean —
trueorfalse, no quotes. Used for yes/no flags like"isAdmin". - null — a deliberate "no value here."
"avatarUrl": nullmeans the user has no avatar — different from the key being missing entirely. - array — an ordered list:
["beta", "early-access"]. - object — a bundle of key/value pairs: the
"profile"block.
That's the whole vocabulary. The most common real-world mistake is the string-vs-number trap: code expects the number 42 but the sends the string "42", and a comparison silently fails. When something behaves weirdly, checking the type of a value is often the fix.