We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8508aba commit 6403c07Copy full SHA for 6403c07
implementations/bind.js
@@ -0,0 +1,15 @@
1
+/**
2
+ *
3
+ bind() creates a new function. When this function is invoked, it is called with the arguments and in the context passed.
4
+
5
+ bind() has two parameters:
6
+ - Context: the value that is passed as this value in the new function.
7
+ - Arguments: arguments passed to the new function.
8
+*/
9
10
+Function.prototype.myBind = function myBind(newContext) {
11
+ const fnArguments = Array.prototype.slice.call(arguments, 1);
12
13
+ oldContext = this;
14
+ return () => oldContext.apply(newContext, fnArguments);
15
+};
0 commit comments