문제
Map, Filter, Reduce - Code Exercises | CroCoder
Map, filter and reduce are the most useful array methods to manipulate arrays and often the hardest to master. Try to solve the given exercises!
www.crocoder.dev
정답
const input = [
{
name: "John",
age: 13,
},
{
name: "Mark",
age: 56,
},
{
name: "Rachel",
age: 45,
},
{
name: "Nate",
age: 67,
},
{
name: "Jennifer",
age: 65,
},
];
const arr = input.map(x => x.age);
console.log([Math.min(...arr), Math.max(...arr), Math.max(...arr) - Math.min(...arr)]);