I'm currently working on a coding exercise, but I've encountered an issue with my if/else structure and I can't figure out what's causing the problem.
Below is the prompt for the exercise along with the code I have written:
Your task is to create a function called fizzBuzz that takes a number as input and returns a corresponding string:
'fizz' if the number is divisible by 3;
'buzz' if the number is divisible by 5;
'fizzbuzz' if the number is divisible by both 3 and 5.
'{number}' if none of the above conditions are met.
function fizzBuzz(number) {
if (number % 3 === 0) {
return "fizz"
};
if (number % 5 === 0) {
return "buzz"
};
if (number % 3 === 0 && number % 5 === 0) {
return "fizzbuz"
};
else return number
}