What's the mistake,always" Oops, try again. It looks like you printed out the wrong number of items."


#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);
for(  i=0;i<numberArray.length;i++ ){
    if(numberArray[i]%5===0&&numberArray[i]%3===0){
        
        console.log('FizzBuzz');
        
    }else if(numberArray[i]%5===0) {
        
        
         console.log('Buzz');
        }else if(numberArray[i]%3===0){
           
        console.log(numberArray[i]='Fizz');    
        }else{
            console.log(i+1);
            }   
} 


My output is like this:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz


#2

Please post always a link to your lesson.
Mostly i Need to read the instructions and i dont wanna search the right lesson.

That would be fantastic :slight_smile:

EDIT
I found it

var numberArray=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
var i; 
// why did you do this? type var in your for Statement like i do for you.
console.log(numberArray); 
// Dont log here anything

for( var i=0;i<numberArray.length;i++ ){
    if(numberArray[i]%5===0&&numberArray[i]%3===0){
        
        console.log('FizzBuzz');
        
    }else if(numberArray[i]%5===0) {
        
        
         console.log('Buzz');
        }else if(numberArray[i]%3===0){
           
        console.log(numberArray[i]='Fizz');     
       // Mystery what you wanna try here ? only console.log('Fizz')
        }else{
            console.log(i+1);
            }   
}

Thats it :slight_smile:


#3

Great,it works now. Thanks for your help. I know what's the mistake now. And sorry for wasn't posting the lesson link here. Forgive me, new member for this platform. Let me link next time. Thanks again, really great help.


#4

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