Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function.prototype.bindRight = function (context, ...firstArgs) {
- return (...secArgs) => {
- return this.apply(null, [...secArgs.reverse(), ...firstArgs.reverse()]);
- };
- };
- function add(x, y, z) {
- return 100 * x + 10 * y + z;
- }
- const add2 = add.bindRight(null, 1, 2);
- const result = add2(3);
- console.log('--result: ', result); // => 321
Add Comment
Please, Sign In to add comment