After let s = "code"; s.toUpperCase(); what is the value of s?
Strings are immutable primitives. Keep the result: s = s.toUpperCase().
Data Types · Exercise 1 of 4
Fifteen multiple-choice questions on JavaScript data types: primitives and objects, typeof, number precision, NaN, BigInt, null and undefined, falsy values, symbols and value vs reference. Pick an option to check your answer instantly.
After let s = "code"; s.toUpperCase(); what is the value of s?
Strings are immutable primitives. Keep the result: s = s.toUpperCase().
Why is { id: 1 } === { id: 1 } false?
Objects are equal only if they are the same object in memory. To compare contents, compare the properties (or use a deep-equality helper).
Which statement about Symbol("id") is correct?
Symbol("id") !== Symbol("id"). The description is only a label. new Symbol() throws a TypeError. Symbol.for("id") returns a shared symbol from the global registry.
How does JavaScript store values of the number type?
There is a single number type for integers and decimals – a 64-bit double. That is why 7 / 2 is 3.5 and why decimals can show rounding errors.
Strings are primitives, yet "abc".length and "abc".toUpperCase() work. Why?
Property access on a primitive creates a short-lived wrapper (String, Number, Boolean, Symbol, BigInt) whose prototype supplies the methods; the wrapper is then discarded.
Timed online tests with instant scores and explanations.