Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. var fizzBuzz = function(num){
  12. for (var i = 1; i <= num; i += 1) {
  13. if (i%3 === 0 && i%5 === 0) {
  14. result = "fizzbuzz";
  15. } else if (i%3 === 0) {
  16. result = "fizz";
  17. } else if (i%5 === 0) {
  18. result = "buzz";
  19. } else {
  20. result = i
  21. }
  22. console.log(result);
  23. }
  24. };
  25. </script>
  26.  
  27.  
  28.  
  29. <script id="jsbin-source-javascript" type="text/javascript">var fizzBuzz = function(num){
  30. for (var i = 1; i <= num; i += 1) {
  31. if (i%3 === 0 && i%5 === 0) {
  32. result = "fizzbuzz";
  33. } else if (i%3 === 0) {
  34. result = "fizz";
  35. } else if (i%5 === 0) {
  36. result = "buzz";
  37. } else {
  38. result = i
  39. }
  40. console.log(result);
  41. }
  42. };</script></body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement