ควิซ JavaScript: Map & Set

Map and Set are JavaScript's built-in collections for key-value pairs and unique values. This quiz checks their basic methods, how keys and duplicates work, iteration order and the differences from plain objects.

ง่าย 10 ข้อ ~5 นาที ผ่านที่ 80% Node.js 22

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

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

ข้อ 1 จาก 10

What does this print?

const s = new Set([1, 2, 2, 3, 3, 3]);
console.log(s.size);
ดูเฉลย

D. 3 A Set stores each value only once, so the duplicates are dropped and three values remain. Use size, not length.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • Removing duplicates with Set
  • Map keys of any type vs object keys that become strings
  • size, get, set, has and iteration
  • Why objects in a Set are compared by reference
  • Turning a Map into JSON

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

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

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