Квиз по 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.

Средний 10 вопроса ~6 минуты Проходной балл: 80% Node.js 22

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

console.log(1 == "1", 1 === "1");
Показать ответ

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.

Что проверяет этот квиз

  • 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()

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.