Skip to content

Instantly share code, notes, and snippets.

@yangsu
Created January 29, 2013 20:13
Show Gist options
  • Save yangsu/4667342 to your computer and use it in GitHub Desktop.
Save yangsu/4667342 to your computer and use it in GitHub Desktop.
JavaScript Times Function Implementation
Number.prototype.times = function (fn) {
var n = this;
while (n > 0) {
fn();
n--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment