This is my code
function test(number) {
if (number % 15 == 0) {
return "FizzBuzz";
}
if (number % 3 == 0) {
return "Fizz";
}
if (number % 5 == 0) {
return "Buzz";
}
return number.toString();
}
I type test(15).
result print "FizzBuzz"
Why doesn't it print "FizzBuzz" "Fizz" and "Buzz" ?
returnbreaks out of the functionreturnwhich means: at this point jump out of function and return the specific value