FizzBuzz game: I can't find the syntax error!


#1

This is my code, which gives a syntax error: unexpected identifier message when run. What's wrong?

for (int i = 1; i<21; i++) {
if (i%3 === 0 && i%5 === 0) {
console.log("FizzBuzz");
} else if (i%3 === 0) {
console.log("Fizz");
} else if (i%5 === 0) {
console.log("Buzz");
} else {
console.log(i);
}
}


#2

Hi @unakamilla

You have to change "int" to "var", we're in javascript here :stuck_out_tongue:

Hold on


#3

Thank you! thank you thank you thank you, I'd been looking for the error for too long I couldn't tell which language I was using. :smile: