JavaScript-Quiz: Map & Set

Map and Set are JavaScript's built-in collections for key-value pairs and unique values. This quiz checks their basic methods, how keys and duplicates work, iteration order and the differences from plain objects.

Leicht 10 Fragen ~5 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?

const s = new Set([1, 2, 2, 3, 3, 3]);
console.log(s.size);
Lösung zeigen

D. 3 A Set stores each value only once, so the duplicates are dropped and three values remain. Use size, not length.

Darum geht es in diesem Quiz

  • Removing duplicates with Set
  • Map keys of any type vs object keys that become strings
  • size, get, set, has and iteration
  • Why objects in a Set are compared by reference
  • Turning a Map into JSON

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.