Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- function fizzbuzz(num) {
- if (num % 3 === 0 && num % 5 === 0) {
- return 'fizzbuzz';
- } else if (num % 3 === 0) {
- return 'fizz';
- } else if (num % 5 === 0) {
- return 'buzz';
- } else {
- return num;
- }
- }
- let i = 1;
- while (i <= 30) {
- console.log(fizzbuzz(i));
- i++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement