JavaScript-Quiz: Scope & Hoisting

This JavaScript quiz covers scope and hoisting, including the temporal dead zone (TDZ). You will predict how var, let, const and functions behave before their line runs, and how inner scopes shadow outer ones.

Mittel 10 Fragen ~6 Minuten Bestanden ab 80% Node.js 22

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 10

What does this print?

console.log(a);
var a = 5;
Lösung zeigen

B. undefined var a is hoisted to the top of its scope and starts as undefined; only the assignment a = 5 stays on its line. So the log runs before the value is set.

Darum geht es in diesem Quiz

  • Hoisting of var: declared early, undefined until assigned
  • The temporal dead zone for let and const
  • Function declarations vs function expressions
  • Block scope, function scope and shadowing
  • Why typeof does not help inside the TDZ

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.