Guest User

Untitled

a guest
Oct 19th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function fizzBuzz(num) {
  2. if ((num % 3 === 0) && (num % 5 === 0)) {
  3. return 'fizzbuzz';
  4. }
  5. else if (num % 3 === 0) {
  6. return 'fizz';
  7. }
  8. else if (num % 5 === 0) {
  9. return 'buzz';
  10. }
  11.  
  12. else {
  13. return num;
  14. }
  15.  
  16.  
  17. // if num is divisible by 3 return 'fizz'
  18. // if num is divisible by 5 return 'buzz'
  19. // if num is divisible by 3 & 5 return 'fizzbuzz'
  20. // otherwise return num
  21. }
Add Comment
Please, Sign In to add comment