Saved in this browser - sign in to keep your review list.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Keep going - a few more words and AI can grade it.
Interview lens
How interviewers actually use this question
Likely follow-ups
Why does typeof null return "object", and how do you check for null reliably?Call it a legacy bug kept for compatibility, then show value === null as the check, since typeof can't tell null from an object.
If primitives are immutable, how can you call "hello".toUpperCase()?JavaScript wraps the string in a temporary String object to find the method. The method returns a new string and the original stays the same.
How do primitives and objects behave differently when you assign them or pass them to a function?Primitives are copied by value. An object variable holds a reference, so a change made through one variable shows up through the other.
What is the difference between null and undefined, and when would you use each one?undefined is the default for a missing value, null is set on purpose. Mention that null == undefined is true while null === undefined is false.
JavaScript has seven primitive types, and a primitive is a value that isn't an object and can't be changed once it exists.
Number covers both integers and decimals, String is text, and Boolean is true or false.
Undefined is what a variable holds when it's declared but never assigned, while null is an absence of value you set on purpose.
Symbol came in ES6 and gives you a unique identifier, and BigInt came in ES2020 for integers beyond Number.MAX_SAFE_INTEGER.
Everything else is an object, and that includes arrays and functions.
One trap I'd point out is that typeof null returns "object", a legacy bug kept for compatibility, so I check for null with === null instead.
Weak answers to avoid
Counts arrays or functions as primitivesArrays and functions are objects. Say that anything outside the seven primitives is an object, even though typeof reports "function" for functions.
Lists five types and forgets Symbol and BigIntLeaving out the ES6 and ES2020 additions suggests your knowledge is dated. Name all seven and say when the last two were added.
Treats null and undefined as the same thingThey mean different things. undefined is the default for an unassigned variable, and null is an empty value you assign on purpose.
Says null is an object because typeof says sotypeof null returning "object" is a legacy bug. null is a primitive, and the reliable check is value === null.
Interview lens
Likely follow-ups, what you can say, and the weak answers to avoid.