Answers for "javascript map return two values"

1

javascript map return array with distinc values

//ES6
let array = [
  { "name": "Joe", "age": 17 },
  { "name": "Bob", "age": 17 },
  { "name": "Carl", "age": 35 }
];
array.map(item => item.age)
  .filter((value, index, self) => self.indexOf(value) === index)

> [17, 35]
Posted by: Guest on July-18-2020

Code answers related to "javascript map return two values"

Code answers related to "Javascript"

Browse Popular Code Answers by Language