Possible Duplicate:
Javascript array sort and unique
I was surprised to see that there is no built in jQuery function for that.
I've seen many solutions on stackoverflow, but the questions were polluted with not-working answers (to find a working one I had to test them all).
So, for future reference and to spare other users the trouble I decided to post this Q&A style.
How to return unique and sorted array values useing jQuery?
Numbers:
// input array
var inputArray = [10, 5, 15, 10, 5, 15];
// expected result array
var resultArray = [5, 10, 15];
Strings:
// input array
var inputArray = ['b', 'a', 'c', 'b', 'a', 'c'];
// expected result array
var resultArray = ['a', 'b', 'c'];