Portfolio Posts Page

Fizz Buzz Challenge

Do you know how to solve the Fizz Buzz Challenge?

You need to write a program that prints the numbers from 1 to 100 such that:

If the number is a multiple of 3, you need to print "Fizz" instead of that number.
If the number is a multiple of 5, you need to print "Buzz" instead of that number.
If the number is a multiple of both 3 and 5, you need to print "FizzBuzz" instead of that number.

Solution in JavaScript by Rafael
============================================
answer = [];

for (let i = 1; i <=100; i++) {

if(i % 15 ==0){
answer.push("FizzBuzz");
}else if(i%5 == 0){
answer.push("Buzz");
}else if(i%3==0){
answer.push("Fizz")
}else{
answer.push(i);
}

}

console.log(answer);

============================================
Portfolio Landing Page