I'm having an issue with adding numbers to an array in JavaScript. I only want to add numbers that are multiples of three. Below is the code snippet:
var numbers = [];
for (i = 1; i <= 200; i++) {
if i % 3 === 0 {
numbers.push(i);
}
}
alert(numbers);
Strangely, the code isn't displaying any output. However, when I remove the if statement and simply add all numbers between 1 and 200, it works fine...
Can you help me identify the error?
Appreciate your assistance!