JavaScript Interview Questions
Q.
What is JavaScript?
▾
Q.
What are the different data types in JavaScript?
▾
Q.
What is the difference between var, let, and const?
▾
Q.
What is hoisting in JavaScript?
▾
Q.
What is the temporal dead zone (TDZ)?
▾
Q.
What is the difference between == and ===?
▾
Q.
What are truthy and falsy values in JavaScript?
▾
Q.
What is the difference between null and undefined?
▾
Q.
What are template literals in JavaScript?
▾
Q.
What are arrow functions, and how are they different from regular functions?
▾
Q.
What is the difference between function declarations and function expressions?
▾
Q.
What are template string tagged functions (tagged templates)?
▾
Q.
What is NaN in JavaScript?
▾
Q.
What is the difference between an array and an object?
▾
Q.
What are some common array methods in JavaScript?
▾
Q.
What is a closure in JavaScript?
▾
Q.
Can you give a practical example of where closures are used?
▾
Q.
What is the 'this' keyword in JavaScript?
▾
Q.
How does 'this' behave differently inside a method, a regular function, and an arrow function?
▾
Q.
What is the difference between call, apply, and bind?
▾
Q.
What is scope in JavaScript?
▾
Q.
What is the scope chain in JavaScript?
▾
Q.
What is event bubbling and event capturing?
▾
Q.
What is event delegation in JavaScript?
▾
Q.
What is the difference between synchronous and asynchronous code?
▾
Q.
What is a callback function?
▾
Q.
What is a Promise in JavaScript?
▾
Q.
What is async/await in JavaScript?
▾
Q.
What is the difference between Promise.all, Promise.race, and Promise.allSettled?
▾
Q.
What is destructuring in JavaScript?
▾
Q.
What is the spread and rest operator in JavaScript?
▾
Q.
What is the JavaScript event loop?
▾
Q.
What is the difference between the microtask queue and the macrotask queue?
▾
Q.
What is prototypal inheritance in JavaScript?
▾
Q.
What is the difference between __proto__ and prototype?
▾
Q.
How do ES6 classes relate to prototypal inheritance?
▾
Q.
What is currying in JavaScript?
▾
Q.
What is debouncing, and how is it implemented?
▾
Q.
What is throttling, and how is it different from debouncing?
▾
Q.
What are higher-order functions in JavaScript?
▾
Q.
What is memoization in JavaScript?
▾
Q.
What is the difference between deep copy and shallow copy?
▾
Q.
What is the difference between synchronous execution context and the call stack?
▾
Q.
What is a WeakMap and WeakSet, and how are they different from Map and Set?
▾
Q.
What is the difference between synchronous generators and async generators?
▾
Q.
What is the module system in JavaScript (ES Modules vs CommonJS)?
▾
Q.
What is the difference between shallow equality and deep equality?
▾
Q.
What is garbage collection in JavaScript?
▾
Q.
What causes memory leaks in JavaScript, and how can they be avoided?
▾
Q.
What is the difference between synchronous throw/catch and Promise rejection handling?
▾
Q.
What is the 'new' keyword, and what does it actually do?
▾
Q.
What is functional programming, and how does JavaScript support it?
▾
Q.
What is the difference between shallow binding of 'this' with bind() and arrow functions?
▾
Q.
What is an IIFE (Immediately Invoked Function Expression)?
▾
Q.
How would you explain the output of console.log(1 + '1') and console.log(1 - '1')?
▾
Q.
What is an Immediately Invoked Async Function Expression (Async IIFE)?
▾
Q.
What are getters and setters in JavaScript?
▾
Q.
Can you give an example use case of getters and setters?
▾
Q.
What is strict mode ('use strict') in JavaScript?
▾
Q.
What are the main benefits of using strict mode?
▾
Q.
What is a polyfill in JavaScript?
▾
Q.
How would you write a polyfill for Array.prototype.map?
▾
Q.
How would you write a polyfill for Array.prototype.filter?
▾
Q.
How would you write a polyfill for Function.prototype.bind?
▾
Q.
How would you implement a debounce function?
▾
Q.
How would you implement a throttle function?
▾
Q.
How would you implement a curry function?
▾
Q.
How would you implement a basic version of Promise (a Promise polyfill)?
▾
Q.
What are the key challenges when writing a custom Promise implementation?
▾
Q.
What is the difference between localStorage, sessionStorage, and cookies?
▾
Q.
When would you choose cookies over localStorage or sessionStorage?
▾
Q.
What is the difference between the Fetch API and XMLHttpRequest?
▾
Q.
Does fetch() reject on an HTTP error status like 404 or 500?
▾
Q.
What is CORS (Cross-Origin Resource Sharing)?
▾
Q.
What is a CORS preflight request?
▾
Q.
What is the difference between setInterval and requestAnimationFrame?
▾
Q.
Why is requestAnimationFrame better for animations than setInterval?
▾