Tell us what’s happening:
My code passes and I’m decently happy with the brevity of it. I wanted to use a for loop on this one. Up to this point, all of my for loops have looked something like for(let 1 = 0; i < arr.length; i++)
After some thinking, ended up with this for loop:
for (let i; arr.length > 0; i)
Would this be considered bad practice? I mainly ask this because I don’t refer to i
at all in the loop. It’s just there to fill out the syntax. Was there a better way I could have written this specific for loop?
Your code so far
// runs as long as the original array still has stuff in it
for (let i; arr.length > 0; i) {
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Chunky Monkey
Link to the challenge: