What's the mistake of my code?Always "SyntaxError: missing ) after condition"


#1


var numberArray=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
var i;
console.log(numberArray);
if(  i=0;i<numberArray.length;i++ ){
    if(numberArray[i]%3===0){
        
        console.log('Fizz');
        
    }else if(numberArray[i]%5===0) {
        
        
         console.log('Buzz');
        }else if(numberArray[i]%5===0&&numberArray[i]%3===0){
           
        console.log('FizzBuzz');    
        }else{
            console.log('No match!');
            }   
}else{
    console.log('Error');}


#2

if(  i=0;i<numberArray.length;i++ ){

There you have a Problem

I think you will loop here

A for Loop Looks like this

for (statement 1; statement 2; statement 3) {
     // do something

 }

#3

Thank you very much. Works now.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.