back to course
Lesson 115 / 115100%· free preview
Exam Prep2/2
Viva Questions
20 short JavaScript viva Q&A.
Common JavaScript Viva Questions and Answers
- What is JavaScript? High-level, interpreted scripting language used to make web pages interactive.
- Who created JS? Brendan Eich at Netscape, 1995.
- Java vs JavaScript? Completely different languages — only the name was a marketing decision in 1995.
- Is JS case-sensitive? Yes —
Nameandnameare different. varvsletvsconst?var(function-scoped, hoisted),let(block-scoped),const(block-scoped + immutable binding).- Data types in JS? Primitive: number, string, boolean, null, undefined, symbol, bigint. Reference: object, array, function.
==vs===?==allows type coercion;===checks both type and value.- What is hoisting? Variable/function declarations are moved to top of scope before execution.
varis hoisted but undefined;let/constenter "temporal dead zone". - What is closure? Function that remembers variables from its outer scope even after the outer function returns.
- What's an arrow function? Shorter syntax:
(a, b) => a + b. Doesn't have its ownthis. - What is the DOM? Document Object Model — tree representation of the HTML document.
innerHTMLvstextContent?innerHTMLparses HTML;textContenttreats as plain text (safer).- What is a Promise? Object representing eventual completion of an async operation. States: pending / fulfilled / rejected.
- What is
async/await? Syntactic sugar over Promises — write async code that looks synchronous. nullvsundefined?undefined= variable declared but no value.null= explicit "no value".- What is event bubbling? Event triggered on a child also fires on its ancestors (innermost first).
- What is JSON? JavaScript Object Notation — text format for data interchange.
JSON.parse()andJSON.stringify(). - What is
thisin JS? Refers to the object that invoked the function (changes based on call context; arrow functions inherit from enclosing scope). - Synchronous vs asynchronous? Sync — line-by-line, blocking. Async — non-blocking (callbacks, Promises, async/await).
- What is the event loop? JS runtime mechanism — picks tasks from the queue and executes them on the single-threaded call stack.
AI-powered recap
Quick recap quiz?
We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.
Ready to move on?
// example library
Want more hands-on snippets in JavaScript?
Browse 2 runnable examples · across 1 chapter · short, copy-paste-friendly · grouped by topic
// did you know?
One surprising fact before your next lesson
Bite-sized programming facts that make your next coffee-break explanation land.
// feedback.matters()
Did this lesson help you?
