Basically, if you are using JavaScript then, you can use the filter method to get all the unique values in an array:
function Unique(value, index, self) {
return self.indexOf(value) === index;
}
// usage example:
var a = ['a', 1, 'a', 2, '1'];
var unique = a.filter(Unique);
console.log(unique); // ['a', 1, 2, '1']
I hope this will help.
Want to become a Java expert? join Java Course now!!
Want to know more about Java? Watch this video on Learn Java | Java Programming for Beginners: