JS. Intermediate JavaScript Questions Breakdown to Crack Any Interview:
Level Type
Intermediate Arrays, objects, DOM, events, ES6 features, scope, closures
1. What is the DOM?
➤ DOM stands for Document Object Model – it represents the structure of an HTML page using objects.
2. What is event bubbling?
➤ When an event starts from the innermost element and bubbles up to its parents.
3. What are array methods like
map(), filter()?➤
map() transforms elements, filter() returns elements that match a condition.4. How do you handle events in JavaScript?
➤ Using
addEventListener():button.addEventListener("click", () => alert("Clicked!"));
5. What is
this in JavaScript?➤
this refers to the object that is currently calling the function.6. What is a closure?
➤ A closure is when a function remembers its lexical scope even after it is executed outside that scope.
7.How do you manipulate classes in DOM?
➤ Using
classList.add(), remove(), toggle().8. What is destructuring?
➤ Extracting values from objects or arrays:
const {name, age} = person;
9. What are default parameters?
➤ You can assign a default value to a function parameter:
function greet(name = "Guest") { ... }
10. Difference between synchronous and asynchronous code?
➤ Synchronous: runs line-by-line.
➤ Asynchronous: does not wait (like API calls,
setTimeout).
Comments
Post a Comment