File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const f1 = ( ...args ) => console . log ( args ) ;
3+ const f1 = ( ...args ) => {
4+ console . log ( args ) ;
5+ } ;
46
57f1 ( 1 , 2 , 3 ) ;
68
79const f2 = ( ...args ) => {
810 args . forEach ( arg => {
11+ console . log ( 'Type: ' + typeof ( arg ) ) ;
912 if ( typeof ( arg ) === 'object' ) {
10- console . log ( typeof ( arg ) + ' : ' + JSON . stringify ( arg ) ) ;
13+ console . log ( 'Value : ' + JSON . stringify ( arg ) ) ;
1114 } else {
12- console . log ( typeof ( arg ) + ' : ' + arg ) ;
15+ console . log ( 'Value : ' + arg ) ;
1316 }
1417 } ) ;
1518} ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
33const obj1 = {
4- f1 : function inc ( a ) {
4+ fn1 : function inc ( a ) {
55 return ++ a ;
66 } ,
77 sum : function ( a , b ) {
@@ -20,11 +20,14 @@ const obj1 = {
2020 }
2121} ;
2222
23- console . log ( 'obj1.f1 .name = ' + obj1 . f1 . name ) ;
23+ console . log ( 'obj1.fn1 .name = ' + obj1 . fn1 . name ) ;
2424console . log ( 'obj1.sum.name = ' + obj1 . sum . name ) ;
25+ console . log ( 'obj1.inc.name = ' + obj1 . inc . name ) ;
2526console . log ( 'obj1.max.name = ' + obj1 . max . name ) ;
27+ console . log ( 'obj1.min.name = ' + obj1 . min . name ) ;
28+ console . log ( 'obj1.dec.name = ' + obj1 . dec . name ) ;
2629
27- console . log ( 'obj1.f1 (5) = ' + obj1 . f1 ( 5 ) ) ;
30+ console . log ( 'obj1.fn1 (5) = ' + obj1 . fn1 ( 5 ) ) ;
2831console . log ( 'obj1.sum(1, 3) = ' + obj1 . sum ( 1 , 3 ) ) ;
2932console . log ( 'obj1.max(8, 6) = ' + obj1 . max ( 8 , 6 ) ) ;
3033
Original file line number Diff line number Diff line change @@ -8,8 +8,12 @@ const city = {
88 } ,
99 f2 : ( ) => {
1010 return this . name ;
11+ } ,
12+ f3 ( ) {
13+ return this . name ;
1114 }
1215} ;
1316
1417console . log ( 'city.f1() = ' + city . f1 ( ) ) ;
1518console . log ( 'city.f2() = ' + city . f2 ( ) ) ;
19+ console . log ( 'city.f3() = ' + city . f3 ( ) ) ;
Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ function f1(a, b) {
77f1 ( 2 , 3 ) ;
88f1 . call ( null , 2 , 3 ) ;
99
10- f1 ( ...[ 2 , 3 ] ) ;
11- f1 . apply ( null , [ 2 , 3 ] ) ;
10+ const arr = [ 2 , 3 ] ;
11+ f1 ( ...arr ) ;
12+ f1 . apply ( null , arr ) ;
You can’t perform that action at this time.
0 commit comments