jQuery to remove duplicate items from array

Find jQuery code to remove duplicate items from an array using $.unique().

Earlier I had posted about jQuery solution to remove item from array, split an array, combine/join arrays and Find index of element in array, And In this post, find how to remove duplicate items from array with example.

$(document).ready(function () {
    var arr = [10, 19, 22, 36, 50, 74, 10, 22];
    $('#dvallElements').html(arr.join("<br />"));
    arr = $.unique(arr);
    $('#dvUniqueItems').html(arr.sort().join("<br />"));
});

See result below

See Complete Code

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...