How to Remove Duplicate Value from an Array in JQuery?

In this article, I will share with you how to remove duplicate values from an array in jQuery using filter() with a simple example. as you know many times we will needed this type of functionality in our web application. when you got the unique values from the given array. here I will provide a simple example of how to remove duplicate values from an array and get the unique values from an array in jQuery.

<html lang="en">
<head>
    <title>Remove Duplicate Values from an Array in jQuery - HackTheStuff</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <script>
        var my_Array = ["PHP","JavaScript","Java","PHP","Python","Java"];

        var NewArray = my_Array.filter(function(element,index,self){
            return index === self.indexOf(element); 
        });

        console.log(NewArray);
    </script>
</body>
</html>

i hope thi will be help to you.

Tags: