This code gets rid of all the duplicate variables. Is there a way to make the array search in this function case insensitive?
var x = ["AAA", "aaa", "bbb", "BBB"];
function unique(list) {
var result = [];
$.each(list, function(i, e) {
if ($.inArray(e, result) == -1) result.push(e);
});
return result;
}
// Output should be AAA, bbb
console.log(unique(x));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Associated JSFiddle here