JSFiddle - React, Tailwind, and code Playground

by pollo

JavaScript

var add = function add (x, y) {
    return +x + +y;
};

var methodise = function methodise(func) {
    return function(a) {
        return func(this, a);
    };
};

var demothodise = function demothodise(meth) {
    return function(that, c) {
        return meth.call(that, c);
    };
};

Number.prototype.add = methodise(add);

//alert((3).add(2));

var xxx = demothodise(Number.prototype.add)(5,6);

alert(xxx);