Solution write-higher-order-arrow-functions.english.md (#18772)

pull/19503/head
Prabhat Kumar Sahu 2018-11-07 17:07:01 +05:30 committed by Kristofer Koishigawa
parent e24a2d9fdb
commit fa4117ae85
1 changed files with 11 additions and 1 deletions

View File

@ -71,6 +71,16 @@ console.log(squaredIntegers);
<section id='solution'>
```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);
```
</section>