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

A loop starts i at 0, increments by 1, and uses i <= items.length while intending to process only valid array indexes. What is the bug?

  1. It performs one extra iteration at index items.lengthՃիշտ պատասխան
  2. It skips index 0
  3. It visits only even indexes
  4. It stops before the final valid index

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

The less-than-or-equal condition admits i when it is exactly equal to the array length, causing one extra iteration beyond the final valid index. Replacing it with the half-open test i < items.length excludes that out-of-range pass.

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

Սկսել վարժանքը
Հարց 117: A loop starts i at 0, increments by 1, and uses i <=… · JavaScript Fundamentals · Questena