Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created November 8, 2011 03:50
Show Gist options
  • Save levinotik/1346947 to your computer and use it in GitHub Desktop.
Save levinotik/1346947 to your computer and use it in GitHub Desktop.
Function.prototype.method = function(name, func) {
this.prototype[name] = func;
return this;
};
Number.method('integer', function() {
return Math[this < 0 ? 'ceiling' : 'floor'](this);
});
document.writeln((-10 / 3).integer());
document.writeln((10 / 3).integer());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment