Welcome to the definitive JavaScript Interview & University Viva Voce Preparation Guide. Curated specifically for BCA Students, Computer Science Undergraduates, Full-Stack Job Seekers, and Tech Bloggers, this high-yield resource distills the most frequently tested JavaScript concepts into clear, authoritative answers.
Answer: JavaScript is a Just-In-Time (JIT) compiled language. In modern engines like Google Chrome's V8, source code is parsed into an Abstract Syntax Tree (AST), converted to bytecode by the Ignition interpreter for instant execution, and concurrently profiled by the TurboFan JIT compiler which compiles frequently executed ("hot") code into optimized native machine code.
Answer: == compares values with implicit type coercion (converting types if they differ, e.g., 5 == "5" is true). === performs strict equality checking without coercion, requiring both the value and the data type to match exactly (5 === "5" is false). In production, always use ===.
Answer: The 7 primitive types are: Number, String, Boolean, Undefined, Null, BigInt, and Symbol. Primitives are immutable and stored directly in the Call Stack by value. All other entities are Reference Objects stored in the Memory Heap.
Answer: undefined signifies that a variable has been declared but not yet assigned any value. null represents an intentional assignment signifying the absence of any object value. Note that typeof undefined === "undefined", while typeof null === "object" due to a legacy 1995 V8 type tag bug.
Answer: Hoisting is JavaScript's compile-phase behavior of allocating memory for variable and function declarations before code execution. var is initialized with undefined. let and const are allocated in the Temporal Dead Zone (TDZ) and remain uninitialized until their physical declaration line, throwing a ReferenceError if accessed prematurely.
Answer: A closure is the combination of an inner function bundled with references to its outer lexical environment. It allows an inner function to access an outer function's variables even after the outer function has completed execution and popped off the Call Stack. Use cases: Data privacy (private variables), function currying, and memoization caches.
Answer: All three explicitly bind the this keyword. call(thisArg, arg1, arg2) executes immediately with comma-separated arguments. apply(thisArg, [argsArray]) executes immediately with arguments in an array. bind(thisArg) returns a brand-new function with this permanently bound without executing immediately.
Answer: Through the Event Loop concurrency model. Synchronous code executes in the single-threaded Call Stack. Asynchronous tasks (timers, fetch) are offloaded to browser Web API background threads. Once finished, callbacks are pushed to task queues (Microtask Queue for Promises; Macrotask Queue for Timers). When the Call Stack is empty, the Event Loop pushes pending callbacks to the stack.
Answer: The Microtask Queue has higher priority. The Event Loop drains the entire Microtask Queue (Promise callbacks, async/await continuations) before executing even a single task from the Macrotask Queue (setTimeout, setInterval).
Answer: The Promise returned by fetch() only rejects on true network failures (DNS lookup failure, loss of internet connection, CORS blockage). For HTTP 404 Not Found or 500 Server Errors, the promise resolves normally. Developers must check if (!response.ok) manually.
Answer:
typeof NaN returns "number".
NaN === NaN returns false (NaN is the only value in JavaScript never equal to itself. Use Number.isNaN() to check).
Answer: Returns false! Due to binary IEEE 754 floating-point precision representation, 0.1 + 0.2 = 0.30000000000000004. To compare safely, use Math.abs((0.1 + 0.2) - 0.3) < Number.EPSILON.
Ready to test your code tracing and problem-solving skills with practical dry runs? Proceed to: JavaScript Practice Sessions & Dry Runs →
Accelerate your JavaScript mastery by studying these tightly connected core tutorials:
Hands-on code execution traces and viva prep.
Concise syntax lookup before interviews.
Full step-by-step master curriculum index.
Core OOP questions asked in university exams.
Top advanced interview question explanations.