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.

मीडियम 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, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।