The problem: How to get the unique values from this array?
const userIds = [12, 14, 44, 12, 56, 30, 12, 14]
ES6 solution
const unique = [...new Set(usersIds)];
Returns
[12, 14, 44, 56, 30]
Engineering diary
The problem: How to get the unique values from this array?
const userIds = [12, 14, 44, 12, 56, 30, 12, 14]
ES6 solution
const unique = [...new Set(usersIds)];
Returns
[12, 14, 44, 56, 30]
Comments are closed.