We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f201a5f commit 542734aCopy full SHA for 542734a
arrow.js
@@ -0,0 +1,28 @@
1
+// ES5 Version:
2
+
3
+// function double(arr) {
4
+// return arr.map(function(val) {
5
+// return val * 2;
6
+// });
7
+// }
8
9
+// Refactor with ES2015 arrow functions
10
11
12
+const double = arr => arr.map(val => val * 2);
13
14
+////////////////////////////////////////////////////////////////
15
16
+Refactor:
17
18
+// function squareAndFindEvens(numbers){
19
+// var squares = numbers.map(function(num){
20
+// return num ** 2;
21
22
+// var evens = squares.filter(function(square){
23
+// return square % 2 === 0;
24
25
+// return evens;
26
27
28
+const squareAndFindEvens = numbers => numbers.map(num => num ** 2).filter(square => square % 2 === 0);
0 commit comments