Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
var add = function(a, b) {
return a-b;
};
Function.method('subtract', add);
var f = function() {};
console.log(String.subtract(1,2));
Number.method('integer', function () {
return Math[this < 0 ? 'ceil' : 'floor'](this);
});
console.log((-10/3).integer());
this.prototype[name] = func;
return this;
};
var add = function(a, b) {
return a-b;
};
Function.method('subtract', add);
var f = function() {};
console.log(String.subtract(1,2));
Number.method('integer', function () {
return Math[this < 0 ? 'ceil' : 'floor'](this);
});
console.log((-10/3).integer());