This is my right solution
function fizzBuzz(data) {
if (data % 3 === 0 && data % 5 === 0) return "Fizz Buzz";
if (data % 3 === 0) return "Fizz";
if (data % 5 === 0) return "Buzz";
return String(data);
}
BUT anyone can explain me why this code doesn't pass the test with number 10
function fizzBuzz(data) {
switch(data) {
case ((Math.ceil(data / 3) *3 ) && (Math.ceil(data / 5) * 5)):
return "Fizz Buzz";
case (Math.ceil(data / 3) * 3):
return "Fizz";
case (Math.ceil(data / 5) * 5):
return "Buzz";
default:
return String(data);
}
}
Created at: 2018/01/18 20:45; Updated at: 2018/01/21 09:36
The question is resolved.