In the chrome console, I can't run any loops. Why is this?
For example, the following will give a syntax error of "Expected '('"
for each (var item in [1, 2, 3]) alert(item)
In the chrome console, I can't run any loops. Why is this?
For example, the following will give a syntax error of "Expected '('"
for each (var item in [1, 2, 3]) alert(item)
each
isn't a Javascript keyword. See the W3Schools page on Javascript's for
statement for reference.
Try the following:
for ( var item in [1,2,3] ) alert(item)