Skip to main content

Q001–Q020

Q001 — Define Automatic Semicolon Insertion precisely.​

  • Level: Beginner
  • Category: Automatic Semicolon Insertion
  • Expected answer: ASI inserts semicolons only at specific grammar points; line breaks can change parse results, especially before (, [, template literals, regex-like tokens, or after return.
  • Reasoning: Tests the governing mechanism.
  • Common incorrect answer: ASI simply adds a semicolon at every newline.
  • Follow-up: Give one minimal example.
  • Related handbook chapter: chapter 01

Q002 — Debug a bug involving Automatic Semicolon Insertion.​

  • Level: Beginner
  • Category: Automatic Semicolon Insertion
  • Expected answer: Apply this rule first: ASI inserts semicolons only at specific grammar points; line breaks can change parse results, especially before (, [, template literals, regex-like tokens, or after return.
  • Reasoning: Tests mechanism-first debugging.
  • Common incorrect answer: ASI simply adds a semicolon at every newline.
  • Follow-up: What evidence would change your hypothesis?
  • Related handbook chapter: chapter 01

Q003 — Name the misconception about Automatic Semicolon Insertion.​

  • Level: Beginner
  • Category: Automatic Semicolon Insertion
  • Expected answer: Correct model: ASI inserts semicolons only at specific grammar points; line breaks can change parse results, especially before (, [, template literals, regex-like tokens, or after return.
  • Reasoning: Tests guarantee vs folklore.
  • Common incorrect answer: ASI simply adds a semicolon at every newline.
  • Follow-up: What bug can the misconception cause?
  • Related handbook chapter: chapter 01

Q004 — What production decision follows from Automatic Semicolon Insertion?​

  • Level: Beginner
  • Category: Automatic Semicolon Insertion
  • Expected answer: Use this constraint: ASI inserts semicolons only at specific grammar points; line breaks can change parse results, especially before (, [, template literals, regex-like tokens, or after return.
  • Reasoning: Tests turning semantics into contracts.
  • Common incorrect answer: ASI simply adds a semicolon at every newline.
  • Follow-up: How would you regression-test it?
  • Related handbook chapter: chapter 01

Q005 — Define script vs module precisely.​

  • Level: Beginner
  • Category: script vs module
  • Expected answer: Module code is always strict, has module-scoped bindings, supports import/export, and participates in module instantiation/evaluation; classic scripts use different global semantics.
  • Reasoning: Tests the governing mechanism.
  • Common incorrect answer: Modules are just scripts downloaded with a different file extension.
  • Follow-up: Give one minimal example.
  • Related handbook chapter: chapter 01

Q006 — Debug a bug involving script vs module.​

  • Level: Beginner
  • Category: script vs module
  • Expected answer: Apply this rule first: Module code is always strict, has module-scoped bindings, supports import/export, and participates in module instantiation/evaluation; classic scripts use different global semantics.
  • Reasoning: Tests mechanism-first debugging.
  • Common incorrect answer: Modules are just scripts downloaded with a different file extension.
  • Follow-up: What evidence would change your hypothesis?
  • Related handbook chapter: chapter 01

Q007 — Name the misconception about script vs module.​

  • Level: Beginner
  • Category: script vs module
  • Expected answer: Correct model: Module code is always strict, has module-scoped bindings, supports import/export, and participates in module instantiation/evaluation; classic scripts use different global semantics.
  • Reasoning: Tests guarantee vs folklore.
  • Common incorrect answer: Modules are just scripts downloaded with a different file extension.
  • Follow-up: What bug can the misconception cause?
  • Related handbook chapter: chapter 01

Q008 — What production decision follows from script vs module?​

  • Level: Beginner
  • Category: script vs module
  • Expected answer: Use this constraint: Module code is always strict, has module-scoped bindings, supports import/export, and participates in module instantiation/evaluation; classic scripts use different global semantics.
  • Reasoning: Tests turning semantics into contracts.
  • Common incorrect answer: Modules are just scripts downloaded with a different file extension.
  • Follow-up: How would you regression-test it?
  • Related handbook chapter: chapter 01

Q009 — Define let/const hoisting and TDZ precisely.​

  • Level: Beginner
  • Category: let/const hoisting and TDZ
  • Expected answer: Lexical declarations are instantiated before execution but remain uninitialized until evaluation reaches the declaration; reads in that interval throw.
  • Reasoning: Tests the governing mechanism.
  • Common incorrect answer: let and const are not hoisted at all.
  • Follow-up: Give one minimal example.
  • Related handbook chapter: chapter 02

Q010 — Debug a bug involving let/const hoisting and TDZ.​

  • Level: Beginner
  • Category: let/const hoisting and TDZ
  • Expected answer: Apply this rule first: Lexical declarations are instantiated before execution but remain uninitialized until evaluation reaches the declaration; reads in that interval throw.
  • Reasoning: Tests mechanism-first debugging.
  • Common incorrect answer: let and const are not hoisted at all.
  • Follow-up: What evidence would change your hypothesis?
  • Related handbook chapter: chapter 02

Q011 — Name the misconception about let/const hoisting and TDZ.​

  • Level: Beginner
  • Category: let/const hoisting and TDZ
  • Expected answer: Correct model: Lexical declarations are instantiated before execution but remain uninitialized until evaluation reaches the declaration; reads in that interval throw.
  • Reasoning: Tests guarantee vs folklore.
  • Common incorrect answer: let and const are not hoisted at all.
  • Follow-up: What bug can the misconception cause?
  • Related handbook chapter: chapter 02

Q012 — What production decision follows from let/const hoisting and TDZ?​

  • Level: Beginner
  • Category: let/const hoisting and TDZ
  • Expected answer: Use this constraint: Lexical declarations are instantiated before execution but remain uninitialized until evaluation reaches the declaration; reads in that interval throw.
  • Reasoning: Tests turning semantics into contracts.
  • Common incorrect answer: let and const are not hoisted at all.
  • Follow-up: How would you regression-test it?
  • Related handbook chapter: chapter 02

Q013 — Define var scope precisely.​

  • Level: Beginner
  • Category: var scope
  • Expected answer: var is function-scoped (or global-script scoped), is initialized to undefined during declaration instantiation, and does not create block scope.
  • Reasoning: Tests the governing mechanism.
  • Common incorrect answer: var behaves exactly like let except it allows redeclaration.
  • Follow-up: Give one minimal example.
  • Related handbook chapter: chapter 02

Q014 — Debug a bug involving var scope.​

  • Level: Beginner
  • Category: var scope
  • Expected answer: Apply this rule first: var is function-scoped (or global-script scoped), is initialized to undefined during declaration instantiation, and does not create block scope.
  • Reasoning: Tests mechanism-first debugging.
  • Common incorrect answer: var behaves exactly like let except it allows redeclaration.
  • Follow-up: What evidence would change your hypothesis?
  • Related handbook chapter: chapter 02

Q015 — Name the misconception about var scope.​

  • Level: Beginner
  • Category: var scope
  • Expected answer: Correct model: var is function-scoped (or global-script scoped), is initialized to undefined during declaration instantiation, and does not create block scope.
  • Reasoning: Tests guarantee vs folklore.
  • Common incorrect answer: var behaves exactly like let except it allows redeclaration.
  • Follow-up: What bug can the misconception cause?
  • Related handbook chapter: chapter 02

Q016 — What production decision follows from var scope?​

  • Level: Beginner
  • Category: var scope
  • Expected answer: Use this constraint: var is function-scoped (or global-script scoped), is initialized to undefined during declaration instantiation, and does not create block scope.
  • Reasoning: Tests turning semantics into contracts.
  • Common incorrect answer: var behaves exactly like let except it allows redeclaration.
  • Follow-up: How would you regression-test it?
  • Related handbook chapter: chapter 02

Q017 — Define bindings vs values precisely.​

  • Level: Beginner
  • Category: bindings vs values
  • Expected answer: A variable binding is a named association in an environment; objects are values, and a binding can reference an object value without storing the object 'inside' the variable.
  • Reasoning: Tests the governing mechanism.
  • Common incorrect answer: Variables either contain primitives or pointers, as a language guarantee.
  • Follow-up: Give one minimal example.
  • Related handbook chapter: chapter 03

Q018 — Debug a bug involving bindings vs values.​

  • Level: Beginner
  • Category: bindings vs values
  • Expected answer: Apply this rule first: A variable binding is a named association in an environment; objects are values, and a binding can reference an object value without storing the object 'inside' the variable.
  • Reasoning: Tests mechanism-first debugging.
  • Common incorrect answer: Variables either contain primitives or pointers, as a language guarantee.
  • Follow-up: What evidence would change your hypothesis?
  • Related handbook chapter: chapter 03

Q019 — Name the misconception about bindings vs values.​

  • Level: Beginner
  • Category: bindings vs values
  • Expected answer: Correct model: A variable binding is a named association in an environment; objects are values, and a binding can reference an object value without storing the object 'inside' the variable.
  • Reasoning: Tests guarantee vs folklore.
  • Common incorrect answer: Variables either contain primitives or pointers, as a language guarantee.
  • Follow-up: What bug can the misconception cause?
  • Related handbook chapter: chapter 03

Q020 — What production decision follows from bindings vs values?​

  • Level: Beginner
  • Category: bindings vs values
  • Expected answer: Use this constraint: A variable binding is a named association in an environment; objects are values, and a binding can reference an object value without storing the object 'inside' the variable.
  • Reasoning: Tests turning semantics into contracts.
  • Common incorrect answer: Variables either contain primitives or pointers, as a language guarantee.
  • Follow-up: How would you regression-test it?
  • Related handbook chapter: chapter 03