Basic JavaScript - Iterate Through an Array with a For Loop

Tell us what’s happening:
Describe your issue in detail here.
So I’ve completed the challenge, just briefly why my answer is correct even though the remaining result is “undefined” can anyone explain
Your code so far

// Setup
const myArr = [2, 3, 4, 5, 6];

// Only change code below this line
for (let total = 0; total < 20; total++) {
  console.log(myArr[total])
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 OPR/101.0.0.0

Challenge: Basic JavaScript - Iterate Through an Array with a For Loop

Link to the challenge:

Run the for loop like this

for(let total =0;total<=myArr.length;total++){

}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.