Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function.prototype.method = function (name, func) {
- this.prototype[name] = func;
- return this;
- };
- Number.method('integer', function () {
- return Math[this < 0 ? 'ceil' : 'floor'](this);
- });
- document.writeln((-10 / 3).integer()); // -3
- var num = Number('1.2');
- alert(num instanceof Number); // true
- alert(num instanceof Function); // false
- alert(Number instanceof Number); // false
- alert(Number instanceof Function); // true
Add Comment
Please, Sign In to add comment