一.bind.call.apply函数的实现 改变函数的执行上下文中的this指向,但不执行该函数(位于Function构造函数的原型对象上的方法) Function.prototype.myBind = function (target) { if (typeof this !== 'function') { throw Error('myBind is not a function') } var that = this var args1 = [...arguments].slice(1)
(1)数组和String对象都有slice()方法. //Array var list = ['A','B','C','D','DS']; console.log(list.slice(,));//截取后还是数组 //输出:["C", "D"] //String var str = 'ABCSDASD'; console.log(str.slice(,)); //输出:CS (2)splice方法 var a = [1,2,3,4,5], b = [1,2,3,4,