3 ...And the good!


#1

for(var i = 1; i < 21; i++) {
if((i%3 === 0) && (i%5 === 0)){
console.log("FizzBuzz");
}
if else(i%3 === 0){
console.log("Fizz");
}
if else(i%5 === 0){
console.log("Buzz");
}
else{
console.log(i)
}

}
What am I doing wrong?


#2

I have no interest in solving it for you, but a whole lot in helping you figure out whatever has got you stuck. Please explain what's preventing you from solving this, what are you missing?

If you don't know what you should be doing right now, that is to identify in what way it behaves differently from the intended behaviour.


#3

I'm expecting a bunch of numbers, fizzes, buzzes and a fizzbuzz. When I run the code I get a syntax error: "SyntaxError: Expected token '('". Not really sure where this is coming from


#4

Running your code on my computer gives:

$ node robiquet.js
/home/bob/robiquet.js:5
if else(i%3 === 0){
   ^^^^

SyntaxError: Unexpected token else
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:141:18)
    at node.js:933:3

#5

haha... oh dear. Thanks!