Skip to content

Commit

Permalink
fix: fix simulate bind code
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZhang123 committed Jul 20, 2018
1 parent 33e05f9 commit 885d657
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion JS/JS-ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ Function.prototype.myBind = function (context) {
return function F() {
// 因为返回了一个函数,我们可以 new F(),所以需要判断
if (this instanceof F) {
return new _this(args, ...arguments)
return new _this(...args, ...arguments)
}
return _this.apply(context, args.concat(...arguments))
}
Expand Down
2 changes: 1 addition & 1 deletion JS/JS-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ Function.prototype.myBind = function (context) {
return function F() {
// we can use `new F()` because it returns a function, so we need to determine
if (this instanceof F) {
return new _this(args, ...arguments)
return new _this(...args, ...arguments)
}
return _this.apply(context, args.concat(...arguments))
}
Expand Down

0 comments on commit 885d657

Please sign in to comment.