JavaScript interview questions and quick answers
Closures, the event loop, this, promises and the core language questions every frontend round asks.
Review 1,019 questions and short answers on JavaScript. Start with real examples below, then search, practise and follow links to full explanations.
JavaScript: questions worth revising first
These answers come from AI Tapri's existing question bank and published interview guides. Open each answer and read the linked in-depth guide for examples and context.
01Are strings mutable in JavaScript?
No. Strings are immutable primitives. Methods like toUpperCase, slice and replace never change the original; they return a new string, so you must assign or use the result.
Read the full explanation02Why does [10, 9, 1].sort() give [1, 10, 9], and how do you sort numbers correctly?
By default sort converts items to strings and compares them in dictionary order, so "10" comes before "9". Pass a comparator like (a, b) => a - b to sort numbers. Note that sort changes the original array.
Read the full explanation03What is this after calling bind twice on the same function?
The first bind wins. A bound function's this is permanent, so calling bind again on it, or call and apply, cannot change it. Only extra preset arguments from the second bind take effect.
Read the full explanation04What is method borrowing, and how do call and apply let you do it?
Method borrowing means using a method from one object on another by passing the other as this with call or apply. A classic case is Array.prototype.slice.call(arguments) on an array-like object.
Read the full explanation05What is the difference between call, apply and bind?
All three set this for a function. call runs it now with arguments listed one by one, apply runs it now with an array of arguments, and bind returns a new function with this fixed, to be run later.
Read the full explanation06How do you check whether a property exists on an object?
Use Object.hasOwn(obj, key) for own properties and the in operator to include inherited ones. Comparing to undefined is unreliable, because a property can exist and hold undefined.
Read the full explanation07What is a common pitfall related to "Are strings mutable in JavaScript"?
Calling str.trim() or str.replace() and ignoring the returned value.
Read the full explanation08How would you explain "Are strings mutable in JavaScript" in an interview?
"Strings are immutable primitives. Their methods return new strings and leave the original untouched, so I always capture the return value. Repeated concatenation in a loop creates many intermediate strings, so for big joins I build an array and call join."
Read the full explanationFind your next answer.
Pick a topic, search a keyword, or open a question to reveal the answer.
JavaScript quick answers
Free to practise. No account needed. Made for quick revision, not rote memorisation.
Keep preparing for JavaScript
Quick answers help with recall; detailed guides explain the reasoning, examples and common mistakes behind each answer.