Skip to content

Commit 992c57a

Browse files
committed
Function conversions
1 parent f7ae305 commit 992c57a

1 file changed

Lines changed: 13 additions & 22 deletions

File tree

assignments/function-conversion.js

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
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);

0 commit comments

Comments
 (0)