Professional Documents
Culture Documents
Program List
Program List
3 Write a JavaScript program that prints the numbers from 1 to 100. But for
multiples of three, print Fizz instead of the number, and for the multiples of
five, print Buzz. For numbers that are multiples of both three and five, print
FizzBuzz
For every number, if it is divisible by both 3 and 5, add FizzBuzz to the result list.
Else, Check if the number is divisible by 3, add Fizz.
Else, Check if the number is divisible by 5, add Buzz.
Else, add the number by converting it to string.
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Functions</h1>
<p id="demo"></p>
<script>
function myFunction() {
let sum = 0;
number=5;
sum += i;
}
document.getElementById("demo").innerHTML = sum;
myFunction();
</script>
</body>
</html>