Guest User

Untitled

a guest
Jun 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 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. function fizz(n){
  12. let result = '';
  13. for(let i = 1; i <= n; i++) {
  14. if(i % 3 === 0) {
  15. if(i % 5 === 0) {
  16. result += 'FizzBuzz, ';
  17. }else{
  18. result += 'Fizz, ';
  19. }
  20. }
  21. else if( i % 5 === 0) {
  22. result += 'Buzz, ';
  23. }else{
  24. result += i;
  25. }
  26. }
  27. return result;
  28. }
  29.  
  30.  
  31. console.log(fizz(12));
  32. </script>
  33.  
  34.  
  35.  
  36. <script id="jsbin-source-javascript" type="text/javascript">function fizz(n){
  37. let result = '';
  38. for(let i = 1; i <= n; i++) {
  39. if(i % 3 === 0) {
  40. if(i % 5 === 0) {
  41. result += 'FizzBuzz, ';
  42. }else{
  43. result += 'Fizz, ';
  44. }
  45. }
  46. else if( i % 5 === 0) {
  47. result += 'Buzz, ';
  48. }else{
  49. result += i;
  50. }
  51. }
  52. return result;
  53. }
  54.  
  55.  
  56. console.log(fizz(12));</script></body>
  57. </html>
Add Comment
Please, Sign In to add comment