File tree 1 file changed +19
-6
lines changed
lib/node_modules/@stdlib/function/ctor
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;
112
112
113
113
Calls the specified function with the given ` this ` argument and arguments provided as an array-like object.
114
114
115
+ <!-- eslint-disable no-invalid-this -->
116
+
115
117
``` javascript
116
118
function add ( x , y ) {
117
- return x + y;
119
+ return this . initial + x + y;
118
120
}
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
121
128
```
122
129
123
130
<a name =" method-bind " ></a >
@@ -142,13 +149,19 @@ var v = add1( 2 );
142
149
143
150
Calls the specified function with the given ` this ` value and arguments.
144
151
152
+ <!-- eslint-disable no-invalid-this -->
153
+
145
154
``` javascript
146
155
function add ( x , y ) {
147
- return x + y;
156
+ return this . initial + x + y;
148
157
}
149
158
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
152
165
```
153
166
154
167
<a name =" method-to-string " ></a >
You can’t perform that action at this time.
0 commit comments