Ask coding questions

← Back to all posts
For loop iterating past limit
ShivankChhaya

I have a for loop in static/script.js, and it seems to be iterating past its limit! the first line is this: for(var i = 0; i < names.length; i++), and names is ['Potion']. So the length should be 1 right? BUT, the loop is iterating at least 2 times! So why would this be happening?

Voters
ShivankChhaya
Comments
hotnewtop
MrVoo

Line 10 has invalid syntax, that's a Python loop!

ShivankChhaya

@MrVoo its not

it works in javascript