const nums = [1, 2, 3, 4, 5];
const result = nums
.filter(n => n % 2 !== 0)
.map(n => n ** 2)
.reduce((acc, n) => acc + n, 0);
const arr = [10, , 20, undefined, 30];
const mapped = arr.map(x => x * 2);
console.log(result, mapped);
Post #3500
1.06K
CHALLENGE
- ❤ 2
- 🔥 2