QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 68

base.rank is 1, and item inherits from base without defining rank itself. What does Object.hasOwn(item, "rank") return?

  1. 1, because it returns the inherited value
  2. undefined, because it returns the missing own value
  3. true, because inherited properties count as owned
  4. false, because rank is not item's own propertyՃիշտ պատասխան

Բացատրություն

Object.hasOwn examines only properties belonging directly to the supplied object, so an inherited rank does not qualify. A true result based on prototype lookup would describe the in operator instead.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 68: base.rank is 1, and item inherits from base without… · JavaScript Fundamentals · Questena