JavaScript Interview Questions With Answers
JavaScript Interview Questions With Answers
1. What is JavaScript?
JavaScript is a high-level, interpreted programming language used to create interactive effects within web
browsers.
- let: block-scoped, not hoisted like var, can be updated but not re-declared in the same scope.
3. What is hoisting?
Hoisting is JavaScript's behavior of moving declarations (variables and functions) to the top of their scope
before execution.
4. What is a closure?
A closure is a function that has access to its own scope, the outer function's scope, and the global scope
6. What is a Promise?
7. What is async/await?
async/await is syntax to handle promises more cleanly. `await` pauses execution until the promise resolves,
The DOM (Document Object Model) represents the structure of a webpage as a tree of objects, allowing
- forEach: executes a function for each element but does not return anything.
Event delegation is a technique where a single event listener is added to a parent element to manage events
12. What are arrow functions and how are they different?
Arrow functions provide a shorter syntax and do not bind their own `this`, `arguments`, or `super`.
The spread operator (`...`) allows an iterable to be expanded into individual elements.
Event bubbling is the process where the event starts from the deepest element and propagates upward
JavaScript Interview Prep Summary
Lexical scope refers to the ability of a function to access variables from the parent scope in which it was
defined.
A function passed into another function as an argument, which is then invoked inside the outer function.
19. What is the difference between shallow copy and deep copy?
Debouncing limits the rate at which a function is executed. It waits a certain amount of time before running
again.