Questenaتمرینی که نشان می‌دهد بعد چه چیزی را مرور کنید
سؤال 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 < 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.

ادامهٔ این آزمون

شروع تمرین
سؤال 108: An array has length n. A loop starts i at 0, increments i… · JavaScript Fundamentals · Questena