Hi. I am at debugging part of JS and I have to fix two errors in a code to print all the numbers from 1 to 5. I wrote a code a bit different, just wrote
for (let i = 0; i <= len-1; i++)
instead of
for (let i = 0; i < len; i++)
which i think is the same? But they say that
Your code should set the terminal condition of the loop so it stops at the last index.
It does tho? It prints numbers 1 2 3 4 5.
Am i missing something?
Your code so far
function countToFive() {
let firstFive = "12345";
let len = firstFive.length;
// Only change code below this line
for (let i = 0; i <= len-1; i++) {
// Only change code above this line
console.log(firstFive[i]);
}
}
countToFive();
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Challenge: Catch Off By One Errors When Using Indexing
Link to the challenge: