File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
lib/node_modules/@stdlib/function/ctor Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,19 @@ var proto = greet.prototype;
112112
113113Calls the specified function with the given ` this ` argument and arguments provided as an array-like object.
114114
115+ <!-- eslint-disable no-invalid-this -->
116+
115117``` javascript
116118function add ( x , y ) {
117- return x + y;
119+ return this . initial + x + y;
118120}
119- var v = add .apply ( null , [ 1 , 2 ] );
120- // returns 3
121+
122+ var ctx = {
123+ ' initial' : 10
124+ };
125+
126+ var v = add .apply ( ctx, [ 1 , 2 ] );
127+ // returns 13
121128```
122129
123130<a name =" method-bind " ></a >
@@ -142,13 +149,19 @@ var v = add1( 2 );
142149
143150Calls the specified function with the given ` this ` value and arguments.
144151
152+ <!-- eslint-disable no-invalid-this -->
153+
145154``` javascript
146155function add ( x , y ) {
147- return x + y;
156+ return this . initial + x + y;
148157}
149158
150- var v = add .call ( null , 1 , 2 );
151- // returns 3
159+ var ctx = {
160+ ' initial' : 10
161+ };
162+
163+ var v = add .call ( ctx, 1 , 2 );
164+ // returns 13
152165```
153166
154167<a name =" method-to-string " ></a >
You can’t perform that action at this time.
0 commit comments