Open Genzhen opened 3 years ago
Function.prototype.uncurring = function() {
let self = this
// this 指向push
return function() {
// 删除数组第一位,并返回
const obj = Array.prototype.shift.call(arguments);
// 数组合并
self.apply(obj, arguments)
}
}
var yideng = Array.prototype.push.uncurring();
(function () {
yideng(arguments, 4);
console.log(arguments); // [1,2,3,4]
})(1, 2, 3);
扫描下方二维码,收藏关注,及时获取答案以及详细解析,同时可解锁800+道前端面试题。
答案