JavaScript interview practice.
Rehearse with explained interview questions. Describe the mechanism, trace an example, and explain a trade-off before revealing the answer.
How to use this session
- Choose a level and session length. Try each prompt before opening the notes.
- Compare your explanation with the source answer and revisit any concept you missed.
- Mark the questions you reviewed. Sign in to save session history; your draft answers stay in this page.
Code is provided for reading and tracing. These sessions do not execute or automatically grade code.
JavaScript practice
Think first. Reveal second.
Explain your reasoning before opening the notes. A focused session lets you choose your question count; mock rounds follow the original guide.
Loading your question pool…
Preview the JavaScript question pool
- What is an execution context and call stack?
An execution context is the information JavaScript uses while running a piece of code, including its variables, scope and this value. The call stack tracks which function is currently running and where execution should return. Each function call adds a context, and returning removes it.
- What is scope? What does lexical mean?
Scope is the part of a program where a variable can be accessed. JavaScript uses lexical scope, which means the available outer variables depend on where a function was defined, not where it is later called. The engine searches outward through surrounding scopes when a name is not found locally.
- What is the difference between var, let and const?
var, let and const declare variables, but they have different scope and initialization rules. let and const are block-scoped, making it easier to keep a variable inside the code that needs it. const prevents reassignment of the binding; it does not make an object immutable.