ควิซ JavaScript: Getters, Setters & static

This JavaScript quiz focuses on accessors and static members. You will predict what getters return, what happens when you assign to a getter-only property, how static members are shared and inherited, and which getters JSON.stringify sees.

ปานกลาง 10 ข้อ ~6 นาที ผ่านที่ 80% Node.js 22

เลือกโหมด

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

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

ข้อ 1 จาก 10

Temp defines get fahrenheit() { ... }. How do you read the value for const t = new Temp(100)?

ดูเฉลย

C. t.fahrenheit A getter is read like a normal property, with no parentheses, and JavaScript calls the function for you. t.fahrenheit() would try to call the returned number, and Temp.fahrenheit looks on the class, not the instance.

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

  • Reading a get property without parentheses
  • Validating input in a set accessor
  • Getter-only properties in sloppy and strict mode
  • static fields, methods and this inside them
  • The infinite recursion trap in setters

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

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

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

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

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