Skip to content

Instantly share code, notes, and snippets.

@mnichols
Created May 30, 2017 15:08
Show Gist options
  • Save mnichols/e87924266db9406932c16bd5563a43b8 to your computer and use it in GitHub Desktop.
Save mnichols/e87924266db9406932c16bd5563a43b8 to your computer and use it in GitHub Desktop.
fizzy
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