JS. Advanced JavaScript Questions Breakdown to Crack Any Interview:
Level Type
Advanced Promises, async/await, event loop, hoisting, this, prototypes, OOP
1. What is a Promise in JavaScript?
➤A Promise represents the eventual result of an asynchronous operation.
2. What is
async/await?➤ A way to write async code that looks synchronous:
async function fetchData() {
const res=await fetch(url);
}
3. What is hoisting?
➤ JavaScript moves variable and function declarations to the top of their scope before execution.
4. What are the differences between
call(), apply(), and bind()?➤ All are used to set
this manually.call()passes args separatelyapply()passes args as arraybind()returns a new function
5. What is the event loop in JavaScript?
➤ It manages execution of code, collecting events, and executing queued sub-tasks (callbacks).
Comments
Post a Comment