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// Take the commented ES5 syntax and convert it to ES6 arrow Syntax
22
3- // let myFunction = function () {
4- // console.log("Function was invoked!");
5- // };
6- // myFunction();
3+ let myFunction = ( ) => {
4+ console . log ( "Function was invoked!" ) ;
5+ } ;
6+ myFunction ( ) ;
77
8- // let anotherFunction = function (param) {
9- // return param;
10- // };
11- // anotherFunction("Example");
8+ let anotherFunction = param => param ;
9+ anotherFunction ( "Example" ) ;
1210
13- // let add = function (param1, param2) {
14- // return param1 + param2;
15- // };
16- // add(1,2);
17-
18- // let subtract = function (param1, param2) {
19- // return param1 - param2;
20- // };
21- // subtract(1,2);
11+ let add = ( param1 , param2 ) => param1 + param2 ;
12+ add ( 1 , 2 ) ;
2213
14+ let subtract = ( param1 , param2 ) => param1 - param2 ;
15+ subtract ( 1 , 2 ) ;
2316
2417// Stretch
2518
26- // exampleArray = [1,2,3,4];
27- // const triple = exampleArray.map(function (num) {
28- // return num * 3;
29- // });
30- // console.log(triple);
19+ exampleArray = [ 1 , 2 , 3 , 4 ] ;
20+ const triple = exampleArray . map ( num => num * 3 ) ;
21+ console . log ( triple ) ;
You can’t perform that action at this time.
0 commit comments