Answers for "js arrary unique"

15

javascript get unique values from array

const myArray = [1,2,3,1,5,8,1,2,9,4];
const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]

const myString = ["a","b","c","a","d","b"];
const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]
Posted by: Guest on July-25-2020
0

array with unique values javascript

let uniqueItems = [...new Set(items)]
Posted by: Guest on December-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language