Last active
March 7, 2017 12:31
-
-
Save yyong37/e9ea253049518c87ca8b to your computer and use it in GitHub Desktop.
Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.method = function(name, func) { | |
if(!this.prototype[name]) { | |
this.prototype[name] = func; | |
} | |
return this; | |
}; | |
Number.method('integer', function() { | |
return Math[this < 0 ? 'ceil' : 'floor'](this); | |
}); | |
document.writeln((-10/3).integer()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment