Advertisement
Guest User

Untitled

a guest
Aug 15th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. function fizzBuzz(num){
  2. for(var i = 1; i <= num; i++){
  3. if(i % 3 === 0 && i % 5 === 0){
  4. console.log('FizzBuzz');
  5. }else if(i % 3 === 0){
  6. console.log('Fizz');
  7. }else if(i % 5 === 0){
  8. console.log('Buzz');
  9. }else{
  10. console.log(i);
  11. }
  12. }
  13. }
  14.  
  15. fizzBuzz(30);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement