Quiz di JavaScript: == 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.

Medio 10 domande ~6 minuti Superato con il 80% Node.js 22

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What does this print?

console.log(1 == "1", 1 === "1");
Mostra la risposta

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.

Cosa copre questo 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()

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.