Skip to content

Instantly share code, notes, and snippets.

@ethagnawl
Created May 9, 2017 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethagnawl/decbd29ddb83a23127191c7435b259cc to your computer and use it in GitHub Desktop.
Save ethagnawl/decbd29ddb83a23127191c7435b259cc to your computer and use it in GitHub Desktop.
fizzbuzz.js
var ns = [];
for (var i = 0; i <= 100; i += 1) { ns.push(i); }
var fizzes = ns.map(function (member) {
if (member % 15 === 0) {
return 'fizzbuzz';
} else if (member % 3 === 0) {
return 'fizz';
} else if (member % 5 === 0) {
return 'buzz';
} else {
return member;
}
});
console.log(fizzes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment