Turning Learners Into Developers
Codekilla
CODEKILLA
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
  1. What is JavaScript? High-level, interpreted scripting language used to make web pages interactive.
  2. Who created JS? Brendan Eich at Netscape, 1995.
  3. Java vs JavaScript? Completely different languages — only the name was a marketing decision in 1995.
  4. Is JS case-sensitive? Yes — Name and name are different.
  5. var vs let vs const? var (function-scoped, hoisted), let (block-scoped), const (block-scoped + immutable binding).
  6. Data types in JS? Primitive: number, string, boolean, null, undefined, symbol, bigint. Reference: object, array, function.
  7. == vs ===? == allows type coercion; === checks both type and value.
  8. What is hoisting? Variable/function declarations are moved to top of scope before execution. var is hoisted but undefined; let/const enter "temporal dead zone".
  9. What is closure? Function that remembers variables from its outer scope even after the outer function returns.
  10. What's an arrow function? Shorter syntax: (a, b) => a + b. Doesn't have its own this.
  11. What is the DOM? Document Object Model — tree representation of the HTML document.
  12. innerHTML vs textContent? innerHTML parses HTML; textContent treats as plain text (safer).
  13. What is a Promise? Object representing eventual completion of an async operation. States: pending / fulfilled / rejected.
  14. What is async/await? Syntactic sugar over Promises — write async code that looks synchronous.
  15. null vs undefined? undefined = variable declared but no value. null = explicit "no value".
  16. What is event bubbling? Event triggered on a child also fires on its ancestors (innermost first).
  17. What is JSON? JavaScript Object Notation — text format for data interchange. JSON.parse() and JSON.stringify().
  18. What is this in JS? Refers to the object that invoked the function (changes based on call context; arrow functions inherit from enclosing scope).
  19. Synchronous vs asynchronous? Sync — line-by-line, blocking. Async — non-blocking (callbacks, Promises, async/await).
  20. 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
Explore examples
// did you know?
One surprising fact before your next lesson
Bite-sized programming facts that make your next coffee-break explanation land.
Did You Know
// feedback.matters()
Did this lesson help you?