var arr = [\'verdana\', \'Verdana\', 2, 4, 2, 8, 7, 3, 6];
result = Array.from(new Set(arr));
console.log(arr);
console.log(result);
i want to re
var arr = ['verdana', 'Verdana', 2, 4, 2, 8, 7, 3, 6];
function getUniqueValuesWithCase(arr, caseSensitive){
let temp = [];
return [...new Set(caseSensitive ? arr : arr.filter(x => {
let _x = typeof x === 'string' ? x.toLowerCase() : x;
if(temp.indexOf(_x) === -1){
temp.push(_x)
return x;
}
}))];
}
getUniqueValuesWithCase(arr, false); // ["verdana", 2, 4, 8, 7, 3, 6]
getUniqueValuesWithCase(arr, true); // ["verdana", "Verdana", 2, 4, 8, 7, 3, 6]