ควิซ 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 และ streak

ตัวอย่างคำถาม

ข้อ 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, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง