JSFiddle - React, Tailwind, and code Playground

by Trần Ngọc Minh

JavaScript

Function.prototype.method = function (name, func) {

    this.prototype[name] = func;

    return this;

};

Number.method('integer', function () {

    return Math[this < 0 ? 'ceil' : 'floor'](this);

});

alert((-10 / 3).integer());  // -3