TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation · 5.9K subscribers
Post #1190 478
✅ Advanced JavaScript Interview Questions with Answers 💼🧠

1. What is a closure in JavaScript?
A *closure* is a function that has access to its outer function's variables, even after the outer function has returned.

function outer() {
  let count = 0;
  return function inner() {
    count++;
    console.log(count);
  }
}
const counter = outer();
counter(); // 1
counter(); // 2

2. Explain event delegation.
Event delegation is a technique where you attach a single event listener to a parent element to handle events on its child elements using event.target.

3. What is the difference between == and ===? 
- == checks for value equality (type coercion allowed). 
- === checks for both value and type (strict equality). 
'5' == 5   // true  
'5' === 5  // false

4. What is the "this" keyword?
this refers to the object that is executing the current function. In arrow functions, this is lexically bound (based on where it's defined).

5. What are Promises? 
Promises handle asynchronous operations. They have 3 states: *pending, resolved, rejected*.

const p = new Promise((resolve, reject) => {
  resolve("Success");
});
p.then(console.log);

6. Explain async/await.
Syntactic sugar over Promises for better readability in async code.

async function fetchData() {
  const res = await fetch(url);
  const data = await res.json();
}

7. What is hoisting?
Variables and function declarations are moved to the top of their scope before code execution.

console.log(a); // undefined
var a = 5;

8. What are arrow functions and how do they differ? 
Arrow functions are shorter and do not have their own this, arguments, or super.

const add = (a, b) => a + b;

9. What is the event loop?
The event loop handles asynchronous callbacks and ensures non-blocking behavior in JS by placing them in the task queue after the call stack is clear.

10. What are IIFEs (Immediately Invoked Function Expressions)?
Functions that run as soon as they are defined.

(function() {
  console.log("Runs immediately");
})();

💬 Double Tap ❤️ For More
More from @coding_interview_preparation
  1. Oct 12, 2026Java Coding Interview Questions Easy 1. Reverse a string without using a built-in reverse…
  2. Oct 10, 2026100 SQL interview questions
  3. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  4. Oct 6, 2026document post
  5. Oct 4, 2026💼 Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  6. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →