Syntax error?

Could someone help me understand why this particular line of code is throwing syntax errors?

for (int i = 0; i < arr.length; i++){};

It seems to not like the int = i statement, but i can’t understand why.
This is Javascript btw

Hi, JS doesn’t have int as a variable keyword. Use either var or let.

1 Like

To add to what @mirja_t said vanilla JS doesn’t have any type key words. If you want those you can learn TS (Type script.)

Oh, okay thanks! Weird, I thought I pulled this directly from some JS code. Oh well, thanks so much!

1 Like

Ah, alright. Thanks for the help!