A: We can use the native filter method of an Array in the following way to get an array with unique values:
Example:
--------
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
// usage example:
var a = ['a', 1, 'a', 2, '1'];
var unique = a.filter(onlyUnique);
console.log(unique); // ['a', 1, 2, '1']
Output:
-------
[
"a",
1,
2,
"1"
]