JavaScript Interview Basics: let vs const, Closures and Event Loop
JavaScript basics: 6 questions every full-stack interview asks
Understand var, let and const, == vs ===, hoisting, closures, the event loop and async/await in plain words, with tiny code you can explain out loud.
Most full-stack interviews start with JavaScript, whether the job uses React, Node.js or Angular. The questions look easy. But interviewers use them to check if you really understand how the language works, or if you only copy code from tutorials.
In this lab you will learn the basics that come up again and again: var, let and const, == vs ===, hoisting, closures, the event loop, and promises vs async/await. Each one starts with an everyday example, then gives the correct technical answer.
The big idea: define it, show it, use it
Every good JavaScript answer has three parts. Use this pattern for any concept they ask.
Spot the difference
Question: “What is a closure?” Two answers. Switch between them and watch what changes.
Quick concept check
Guess the answer first. Then tap each card to flip it.
Key concepts, explained simply
Analogy first, then the real answer. Learn these six and you can handle most JavaScript basics rounds.
function makeCounter() {
let count = 0; // private variable
return () => ++count; // closure remembers count
}
const next = makeCounter();
console.log(next(), next()); // 1 2
console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve().then(() => console.log('C'));
console.log('D'); // prints A, D, C, B
Build your concept answer
Fill the blanks. Your answer writes itself on the right.
Three model answers to common JS questions
Read each one aloud. Notice the define, show, use pattern in every answer.
“var is function-scoped and can be declared again, so it can leak out of an if block or a for loop. let and const are block-scoped, so they stay inside the curly braces where they are declared. const also cannot be re-assigned, though an object inside it can still change. In my projects I use const by default, let for values that change, and I avoid var. This prevents bugs like one loop variable being shared by every callback.”
“JavaScript runs on a single main thread, so it does one thing at a time on the call stack. Slow work like timers, clicks or fetch calls is handled by the browser or Node.js. When that work is done, its callback waits in a queue. When the call stack is empty, the event loop first runs all microtasks, like promise callbacks, and then picks the next task, like a setTimeout callback. That is why a resolved promise logs before a setTimeout with zero delay.”
“A promise is a value that will arrive later. It starts as pending and then becomes fulfilled or rejected. Long .then() chains can get hard to read. async/await is built on promises, but it reads like normal top-to-bottom code. Inside an async function I write const res = await fetch(url), and I wrap it in try/catch to handle errors. If two calls do not depend on each other, I run them together with Promise.all so they finish faster.”
Four mistakes that cost freshers the JS round
Test yourself
Question 1 of 5
Rehearse before the real thing
Pick one concept, press start and explain it out loud: define it, show a tiny example, say where you used it. The ring turns amber at 60 seconds and red at 90.
- 1let/const: block. var: function
- 2Use === not ==
- 3Closure = remembered variables
- ★Sync, then promises, then timers
Screenshot it. Save it. Share it.
Keep this card on your phone and look at it five minutes before your interview.
Quick answers
Do I need to know ES6 features?
Yes. let and const, arrow functions, template literals, destructuring, spread, classes, modules and promises all came with ES6 (2015). Modern code uses them everywhere, so interviewers expect them.
Will I have to write code live?
Often, yes. Many companies use a shared online editor or a short live coding round. Practise writing small functions without autocomplete and saying the output aloud.
Is JavaScript the same as Java?
No. They are different languages with different designs. The similar name came from marketing in the 1990s. If someone asks, say this calmly; it shows good basics.
What should I study after these basics?
Learn the this keyword, arrow functions, array methods like map, filter and reduce, and the DOM. Then move to React or Node.js. Later labs in this track cover both.

One Comment