Skip to content

Commit d8914f5

Browse files
issue#25 - Implement Function.prototype.bind()
1 parent fbed664 commit d8914f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

implementations/bind.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
that wraps the original function object.
88
*/
99

10-
Function.prototype.altBind = function (someObj, ...outerFuncArguments1) {
10+
Function.prototype.altBind = function (someObj, ...outerFuncArguments) {
1111
const targetFunc = this;
1212

1313
// return inner function
14-
return function (...innerFuncArgs1) {
14+
return function (...innerFuncArgs) {
1515

1616
let propKey = Math.random().toString();
1717
while (someObj.hasOwnProperty(propKey)) {
@@ -20,8 +20,8 @@ Function.prototype.altBind = function (someObj, ...outerFuncArguments1) {
2020
someObj[propKey] = targetFunc;
2121

2222
// prepend outer args to inner args
23-
const result = someObj[propKey](...outerFuncArguments1, ...innerFuncArgs1);
23+
const result = someObj[propKey](...outerFuncArguments, ...innerFuncArgs);
2424
delete someObj[propKey];
2525
return result;
26-
}
27-
}
26+
};
27+
};

0 commit comments

Comments
 (0)