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

Spot the array-iteration result: for...in is used on ["a", "b"] with no extra properties. What does it yield?

  1. The values a and b
  2. The numeric values 0 and 1
  3. The strings 0 and 1Ճիշտ պատասխան
  4. Two arrays pairing each index with a value

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

Array indexes are enumerable string property keys, so for...in yields strings such as 0 and 1 rather than the element values. Expecting a and b confuses key enumeration with the direct value iteration performed by for...of.

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

Սկսել վարժանքը
Հարց 103: Spot the array-iteration result: for...in is used on ["a",… · JavaScript Fundamentals · Questena