3 fizzbuzz problem is it about indent? or sth else


#1

cheers everyone...


#2

@boardblaster29586 looks her's my code
for (var i = 1; i < 21; i++) {
if ( i % 3 === 0 && i % 5 === 0 ) {
console.log("FizzBuzz }
else if ( i % 5 === 0 ) {
console.log("Buzz }
else if ( i % 3 === 0 ) {
console.log("Fizz }
else {
console.log(i);
}
};


#3

any clue why the code isn't working.....

i thought it might be problems with indentation?


#4

@boardblaster29586 see i think u use the ;(semicolon) eraly at last second line, which did't take the condition to end


#5

@boardblaster29586 As u know function run from above to bottom, the see use when i===15 first it see ur if condition it say that if i%3, thus i prints out it's value to console f fizz..

it never go to i%3===o && i %5===0, thus we did't get the required result, so use conditions properly keep in mind execution of program held from top to botom


#6

Your code is wrong because for the console.log() part you end it with a },
for ex. your code has console.log("Buzz} when it should be console.log("Buzz") }