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]const unique = [...new Set(array.map(item => item.age))];
Also in JavaScript:
- js generate list of names with forloop
- parse tree for expression
- get random numbers javascript
- javascript funtion
- react state array push
- Bitwise Operators js
- coin change problem all combinations javascript
- instanr pagination ajax weblesson
- charat javascript
- react native onChangeText resize the background image
- postgresql json array contains
- vue current year
- multiple ternary operator javascript
- Parallax.js wrapper for react
- three.js renderer background color
- is undefined javascript
- different types ways of export and import in javascript
- react pass parameter to component
- jsonb_set remove key
- javascript find element in array and remove
- create new angular project specific version
- es6 method definition syntax
- three js get size of object
- jQuery check element has focus