标签:his 方法 res function javascrip lse window err ext
手写实现如下:
Function.prototype.myApply = fucntion(context) { if(typeof this !== ‘function‘) { throw new TypeError(‘not a function!‘) } context = context || window context.fn = this let result if(arguments[1]) { result = context.fn(...arguments[1]) }else{ result = context.fn() } delete context.fn return result }
JavaScript基础之--- 手写 apply方法 的实现
标签:his 方法 res function javascrip lse window err ext
原文地址:https://www.cnblogs.com/james23dong/p/12564202.html