🟢 Basic JavaScript Interview Questions
1. What is JavaScript, and how is it different from Java?
2. What are the different data types in JavaScript?
3. What is the difference between var, let, and const?
4. What is undefined vs null in JavaScript?
5. How is == different from ===?
6. What is the typeof operator used for?
7. What are template literals, and how do you use them?
8. How do you create and call a function in JavaScript?
9. What are arrow functions and how do they differ from regular functions?
10.How can you convert a string to a number in JavaScript?
🟡 Intermediate JavaScript Interview Questions
11.What is hoisting in JavaScript?
12.Explain scope and the difference between local and global scope.
13.What is a closure in JavaScript? Provide an example.
14.What are callback functions, and why are they used?
15.What are Promises in JavaScript? How do they help in asynchronous programming?
16.What is the difference between synchronous and asynchronous code?
17.Explain the concept of event bubbling and event capturing.
18.What are higher-order functions? Give an example.
19.What is the difference between map(), forEach(), filter(), and reduce()?
20.What is Destructuring Assignment in JavaScript?
🔵 Advanced JavaScript Interview Questions
21.What is the event loop and how does it work in JavaScript?
22.Explain async/await with an example.
23.What is the difference between call, apply, and bind methods?
24.What is prototype and prototypal inheritance in JavaScript?
25.What are modules in JavaScript (import/export)?
26.What is this keyword in JavaScript? How does its behavior change in arrow functions?
27.What are JavaScript objects and how are they different from arrays?
28.Explain rest and spread operators with examples.
29.What is debouncing and throttling in JavaScript?
30.How does garbage collection work in JavaScript?
⚫ Browser and DOM-related JavaScript Questions
31.What is the DOM (Document Object Model)?
32.What is the difference between getElementById() and querySelector()?
33.How can you change HTML content dynamically using JavaScript?
34.What is event delegation in JavaScript?
35.What are the differences between innerHTML, innerText, and textContent?
36.How can you prevent the default behavior of an event in JavaScript?
37.What are cookies, localStorage, and sessionStorage?
38.What are the steps to fetch data from an API using fetch()?
39.How do you handle errors in async functions?
40.What are Web APIs, and can you give some examples?
🧩 Problem-Solving / Coding-Based Questions
41.Write a function to reverse a string in JavaScript.
42.How would you remove duplicates from an array?
43.Write a function to check if a number is prime.
44.Write a function that counts the number of vowels in a string.
45.Implement a function that checks if a string is a palindrome.
46.Write an example of using a Promise with .then() and .catch().
47.Write a program to fetch and display user data using fetch() and async/await.
48.Write a function that flattens a nested array.
49.How would you clone an object in JavaScript?
50.Write a function to find the maximum number in an array.