Solution write-higher-order-arrow-functions.english.md (#18772)
This commit is contained in:
committed by
Kristofer Koishigawa
parent
e24a2d9fdb
commit
fa4117ae85
@ -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>
|
||||
|
Reference in New Issue
Block a user