Preparing for a JavaScript interview? Here are 60 popular questions that frequently come up in interviews. These cover a wide range of topics to help you thoroughly prepare.
Basics & Fundamentals
- What is the difference between ‘Pass by Value’ and ‘Pass by Reference’?
- What is the difference between
map
andfilter
? - What is the difference between
map()
andforEach()
? - What is the difference between Pure and Impure functions?
- What is the difference between
for-in
andfor-of
? - What are the differences between
call()
,apply()
, andbind()
? - List out some key features of ES6.
- What’s the spread operator in JavaScript?
- What is the rest operator in JavaScript?
- What are DRY, KISS, YAGNI, and SOLID principles?
- What is temporal dead zone?
- Different ways to create an object in JavaScript?
- What’s the difference between
Object.keys()
,Object.values()
, andObject.entries()
? - What’s the difference between
Object.freeze()
vsObject.seal()
? - What is a polyfill in JavaScript?
- What is a generator function in JavaScript?
- What is prototype in JavaScript?
- What is IIFE (Immediately Invoked Function Expression)?
- What is CORS (Cross-Origin Resource Sharing)?
- What are the different data types in JavaScript?
Advanced JavaScript Concepts
- What is the difference between TypeScript and JavaScript?
- What is authentication vs authorization?
- Difference between
null
andundefined
? - What is the output of
3 + 2 + "7"
? - Slice vs Splice in JavaScript?
- What is destructuring?
- What is
setTimeout()
in JavaScript? - What is
setInterval()
in JavaScript? - What are Promises in JavaScript?
- What is a call stack in JavaScript?
- What is a closure?
- What are callbacks in JavaScript?
- What are Higher Order Functions in JavaScript?
- What is the difference between
==
and===
in JavaScript? - Is JavaScript a dynamically typed language or a statically typed language?
- What is the difference between IndexedDB and sessionStorage?
- What are Interceptors?
- What is Hoisting?
- What are the differences between
let
,var
, andconst
? - Differences between
Promise.all()
,allSettled()
,any()
,race()
?
Performance & Optimization
- What are the limitations of arrow functions?
- What is the difference between
find()
vsfindIndex()
? - What is tree shaking in JavaScript?
- What is the main difference between Local Storage and Session Storage?
- What is
eval()
? - What is the difference between shallow copy and deep copy?
- What are the differences between undeclared and undefined variables?
Event Handling
- What is event bubbling?
- What is event capturing?
- What are cookies?
- What is the
typeof
operator? - What is
this
in JavaScript and how does it behave in various scenarios?
Miscellaneous
- How do you optimize the performance of an application?
- What is meant by debouncing and throttling?
- What is a closure in JavaScript, and how does it work?
- What is an event loop in JavaScript?
- How does JavaScript handle asynchronous code execution?
- What is a service worker?
- What is an anonymous function?
- What is memoization in JavaScript?
These questions will help you prepare for various aspects of JavaScript, from the basics to advanced concepts. Make sure to understand each concept thoroughly, as interviewers often prefer candidates who can explain their reasoning behind an answer, especially when it involves coding tasks.