@@ -139,31 +139,6 @@ console.log(b); // ?
139
139
140
140
<!-- v -->
141
141
142
- ``` js [1-30]
143
- // Create code for next conditions
144
- function calculate () {
145
- /* put your code here */
146
- }
147
- calculate (" +" )(1 )(2 ); // 3
148
- calculate (" *" )(2 )(3 ); // 6
149
- ```
150
-
151
- <!-- v -->
152
-
153
- ``` js [1-30]
154
- // Create code for next conditions
155
- let sum = function () {
156
- /* put your code here */
157
- };
158
- let s = sum ();
159
- alert (s ()); // 0
160
- alert (s (1 )()); // 1
161
- alert (s (1 )(2 )()); // 3
162
- alert (s (3 )(4 )(5 )()); // 12
163
- ```
164
-
165
- <!-- v -->
166
-
167
142
``` js [1-30]
168
143
(function (x ) {
169
144
return (function (y ) {
@@ -211,25 +186,6 @@ console.log(fnRes2()); //?
211
186
212
187
<!-- v -->
213
188
214
- ``` js [1-30]
215
- /*
216
- - Do you understand the closure?
217
- - Yes!
218
- - Write a function, that does this next:
219
- */
220
- const func = (a , b , c , d , e ) => a + b + c + d + e;
221
-
222
- const hof = yourFunction (func);
223
-
224
- console .log (hof (1 , 2 , 3 , 4 , 5 )); // 15
225
- console .log (hof (2 , 3 , 4 )(5 , 6 )); // 20
226
- console .log (hof (3 , 4 )(5 , 6 )(7 )); // 25
227
- console .log (hof (4 , 5 )(6 )(7 , 8 )); // 30
228
- console .log (hof (5 )(6 )(7 )(8 )(9 )); // 35
229
- ```
230
-
231
- <!-- v -->
232
-
233
189
``` js [1-30]
234
190
var a = 1 ;
235
191
function b () {
@@ -377,91 +333,67 @@ console.log(a); // ?
377
333
378
334
<!-- v -->
379
335
380
- ``` js [1-10]
381
- // Define a
382
- a == 1 && a == 2 && a == 3 ; // true
383
- ```
384
-
385
- <!-- v -->
386
-
387
336
``` js [1-30]
388
- const fn = {};
389
- function valueAccessor (value ) {
390
- var accessor = function (newValue ) {
391
- if (arguments .length === 0 ) {
392
- return value;
393
- }
394
- value = newValue;
395
- };
396
- accessor .__proto__ = fn;
397
- return accessor;
398
- }
399
- const a = valueAccessor (5 );
400
- fn .incrementValue = function () {
401
- this (this () + 1 );
337
+ var foo = {
338
+ bar : function () {
339
+ return this .baz ;
340
+ },
341
+ baz: 1 ,
402
342
};
403
- a .incrementValue ();
404
- a (); // ?
343
+ typeof (f = foo .bar )(); // ?
405
344
```
406
345
407
346
<!-- v -->
408
347
409
348
``` js [1-30]
410
- // Update code for conditions
411
- function A () {
412
- this .value = 1 ;
413
- }
414
- const B = function () {};
415
- /* put your code here */
416
- const b = new B ();
417
- b .value === undefined ; // should be true
418
- b instanceof A ; // should be true
419
- ```
420
-
421
- <!-- v -->
349
+ /*
350
+ - Do you understand the closure?
351
+ - Yes!
352
+ - Write a function, that does this next:
353
+ */
354
+ const func = (a , b , c , d , e ) => a + b + c + d + e;
422
355
423
- <!-- eslint-skip -->
356
+ const hof = yourFunction (func);
424
357
425
- ``` js [1-20]
426
- // create singleton
427
- const getInstance = /* put your code here */
428
- const o1 = getInstance ();
429
- const o2 = getInstance ();
430
- o1 instanceof User; // true
431
- o1 === o2; // true
358
+ console .log (hof (1 , 2 , 3 , 4 , 5 )); // 15
359
+ console .log (hof (2 , 3 , 4 )(5 , 6 )); // 20
360
+ console .log (hof (3 , 4 )(5 , 6 )(7 )); // 25
361
+ console .log (hof (4 , 5 )(6 )(7 , 8 )); // 30
362
+ console .log (hof (5 )(6 )(7 )(8 )(9 )); // 35
432
363
```
433
364
434
365
<!-- v -->
435
366
436
- <!-- eslint-skip -->
437
-
438
- ``` js [1-20]
439
- // create singleton
440
- const User = /* your code */
441
- const u1 = new User (1 );
442
- const u2 = new User (2 );
443
- u1 === u2; // true
367
+ ``` js [1-30]
368
+ // Create “native” methods Define a repeatify function on the String object.
369
+ // The function accepts an integer that specifies how many times the string has to be repeated.
370
+ // The function returns the string repeated the number of times specified. For example:
371
+ console .log (" hello" .repeatify (3 )); // hellohellohello
444
372
```
445
373
446
374
<!-- v -->
447
375
448
376
``` js [1-30]
449
- var foo = {
450
- bar : function () {
451
- return this .baz ;
452
- },
453
- baz: 1 ,
454
- };
455
- typeof (f = foo .bar )(); // ?
377
+ // Create code for next conditions
378
+ function calculate () {
379
+ /* put your code here */
380
+ }
381
+ calculate (" +" )(1 )(2 ); // 3
382
+ calculate (" *" )(2 )(3 ); // 6
456
383
```
457
384
458
385
<!-- v -->
459
386
460
387
``` js [1-30]
461
- // Create “native” methods Define a repeatify function on the String object.
462
- // The function accepts an integer that specifies how many times the string has to be repeated.
463
- // The function returns the string repeated the number of times specified. For example:
464
- console .log (" hello" .repeatify (3 )); // hellohellohello
388
+ // Create code for next conditions
389
+ let sum = function () {
390
+ /* put your code here */
391
+ };
392
+ let s = sum ();
393
+ alert (s ()); // 0
394
+ alert (s (1 )()); // 1
395
+ alert (s (1 )(2 )()); // 3
396
+ alert (s (3 )(4 )(5 )()); // 12
465
397
```
466
398
467
399
<!-- v -->
0 commit comments