-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfizzbuzz.html
More file actions
40 lines (33 loc) · 875 Bytes
/
Copy pathfizzbuzz.html
File metadata and controls
40 lines (33 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<title>Fizz Buzz</title>
</head>
<body>
<p>
For any number entered...
</p>
<p>If the number is a multiple of three, print "Fizz"</p>
<p>If the number is a multiple of five, print "Buzz"</p>
<p>For numbers that are multiples of three and five, print "FizzBuzz"</p>
<p>For numbers who don't meet the above conditions, print the number.</p>
<p>
In this exercise we're introducing a function. Don't use a prompt
for user input, instead always run the function through your browsers
debugger. (If you need help finding out how to do this, please ask.)
</p>
<script type="text/javascript">
function fizzBuzz(number) {
if (number % 3 === 0 && number % 5 === 0) {
console.log('FizzBuzz');
return;
}
if (number % 3 === 0) {
console.log('Fizz');
} else if (number % 5 === 0) {
console.log('Buzz');
}
}
</script>
</body>
</html>