SyntaxError: Unexpected token )


#1

So here is my code, what is wrong with it?

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

#2

try this

var aaa=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
var func=function(){
    for(i=0;i<aaa.length;i++){// problem here for(;;) not for(,,)
        if(aaa[i]%3===0 && aaa[i]%5!==0){//using the '=':wrong instead use '=='or '==='or'!=='
          console.log("Fizz");
        }else if(aaa[i]%5===0&&aaa[i]%3!==0){
          console.log("Buzz");
        }else if(aaa[i]%3===0&&aaa[i]%5===0){
          console.log("FizzBuzz") ; 
        }else{
            console.log(aaa[i]);   
        }
    }
};

func();

the problem was you were doing

for(i=0,i<aaa.length,i++)

but it should rather be

for(i=0;i<aaa.length;i++)