From fa4117ae854d3e8aa416b5a3771b5e1323738060 Mon Sep 17 00:00:00 2001 From: Prabhat Kumar Sahu Date: Wed, 7 Nov 2018 17:07:01 +0530 Subject: [PATCH] Solution write-higher-order-arrow-functions.english.md (#18772) --- .../write-higher-order-arrow-functions.english.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions.english.md index b4e174aa1da..3942dd1f9f8 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions.english.md @@ -71,6 +71,16 @@ console.log(squaredIntegers);
```js -// solution required +const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]; +const squareList = (arr) => { + "use strict"; + // change code below this line + const squaredIntegers = arr.filter(num => Number.isInteger(num) && num > 0).map((x) => x * x); + // change code above this line + return squaredIntegers; +}; +// test your code +const squaredIntegers = squareList(realNumberArray); +console.log(squaredIntegers); ```