QuestenaPráctica que te muestra qué repasar después
Pregunta 108

An array has length n. A loop starts i at 0, increments i by 1, and must visit each valid index exactly once. Which condition is correct?

  1. i <= n
  2. i > n
  3. i >= n
  4. i < nRespuesta correcta

Explicación

Valid indexes for a nonempty array of length n run from 0 through n - 1, so i < n stops immediately before the out-of-range index n. Using i <= n permits one extra body execution and is the classic boundary mistake.

Continúa con este test

Empezar la práctica
Pregunta 108: An array has length n. A loop starts i at 0, increments i… · JavaScript Fundamentals · Questena