Tell us what’s happening:
Your code so far
function countToFive() {
let firstFive = "12345";
let len = firstFive.length - 1;
// Only change code below this line
for (let i = 0; i < len; 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
.
Challenge: Catch Off By One Errors When Using Indexing
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing
So the problem tells me to “Fix the two indexing errors in the following function so all the numbers 1 through 5 are printed to the console,” however the solution that works doesnt print numbers 1 - 5 in the console, it prints 1-4… I had a solution that printed 1-5 and it was marked wrong by the program. Am i missing something?