JavaScript-Quiz: == vs ===

This JavaScript equality quiz compares loose ==, which converts types first, with strict ===, which does not. You will work through the classic traps with null, NaN, empty strings and objects, and learn which comparison to use by default.

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(1 == "1", 1 === "1");
Lösung zeigen

B. true false == converts the string "1" to the number 1 before comparing, so it is true. === sees a number and a string, different types, so it is false.

Darum geht es in diesem Quiz

  • How == converts types and === does not
  • null == undefined and why null == 0 is false
  • NaN is not equal to anything, even itself
  • Objects and arrays are compared by reference
  • Object.is() and Number.isNaN()

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.