3 ms·
You can still emulate this to an extent with a wrapper function: function selfBind(f) { return function g(...args) { return f.call(this, g, .
by LegionMammal978 2y ago
You can still emulate this to an extent with a wrapper function:
function selfBind(f) {
return function g(...args) {
return f.call(this, g, ...args);
};
}
let add = selfBind(function (callee, a) {
return a + callee.amount;
});
add.amount = 2;
/* ... */
Though obviously it isn't quite as straightforward as 'arguments.callee'.