Created
December 17, 2016 14:50
-
-
Save Philocoder93/8454f9e1b6534cdf93906cf165be8319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fizzBuzz = function(a) { | |
| for (i = 1; i <= a; i++) { | |
| if (fizz(i)&&buzz(i)) { | |
| console.log("fizzBuzz"); | |
| } | |
| else if (fizz(i)) { | |
| console.log("fizz"); | |
| } | |
| else if (buzz(i)) { | |
| console.log("buzz"); | |
| } | |
| else { | |
| console.log(i); | |
| } | |
| } | |
| }; | |
| var fizz = function(a) { | |
| if ((a % 3) === 0) { | |
| return true; | |
| } | |
| else { | |
| return false; | |
| } | |
| }; | |
| var buzz = function(a) { | |
| if ((a % 5) === 0) { | |
| return true; | |
| } | |
| else { | |
| return false; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment