Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save harmoniemand/d6c9e3d053b9f1f5baf8204bf0fd9774 to your computer and use it in GitHub Desktop.
Save harmoniemand/d6c9e3d053b9f1f5baf8204bf0fd9774 to your computer and use it in GitHub Desktop.
String.prototype.fizz = function (i) {
return this + (i % 3 == 0 ? 'fizz': '');
};
String.prototype.buzz = function (i) {
return this + (i % 5 == 0 ? 'buzz': '');
};
for (var i = 0; i < 20; i++) {
console.log(i + " :".fizz(i).buzz(i));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment