Created
May 30, 2017 15:08
-
-
Save mnichols/e87924266db9406932c16bd5563a43b8 to your computer and use it in GitHub Desktop.
fizzy
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 fizzBuzzCustom = function(stringOne, stringTwo, numOne, numTwo) { | |
stringOne = stringOne || 'Fizz'; | |
stringTwo = stringTwo || 'Buzz'; | |
numOne = numOne || 3; | |
numTwo = numTwo || 5; | |
var ret = [] | |
for (var i = 1; i <= 100; ++i) { | |
if (i % numOne === 0 && i % numTwo === 0) { | |
ret.push(stringOne + stringTwo); | |
} else if (i % numOne === 0) { | |
ret.push(stringOne); | |
} else if (i % numTwo === 0) { | |
ret.push(stringTwo); | |
} else { | |
ret.push(i); | |
} | |
} | |
return ret; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment