Квиз по 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 и серию.

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

Вопрос 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, серию, значки и историю.

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

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