How to remove duplicate value from array in Jquery?
In this post, i would like to show you how to remove duplicate value from javascript array. we will use jquery filter for remove duplicates value from array. you can simply delete duplicate string in jquery array.
Actually, very few months ago i need to work with jquery array. i have multiple time duplicate value in javascript array. i don't require to display then again and again, i just want to remove that same value in jquery. i had found out the solution of remove duplicates value from array in jquery.
So, here i am going to share simple example, so you can check it:
Example:
<!DOCTYPE html>
<html>
<head>
<title>How to remove duplicate value from array in Jquery? - ItSolutionStuff.com</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
var myArray = ["Hardik", "Paresh", "Sagar", "Hardik", "Rahul"];
var myNewArray = myArray.filter(function(elem, index, self) {
return index === self.indexOf(elem);
});
console.log(myNewArray);
</script>
</body>
</html>
Output:
Array(4)
0: "Hardik"
1: "Paresh"
2: "Sagar"
3: "Rahul"
I hope it can help you...

Hardik Savani
I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to get last element of array in Javascript?
- How to check image loaded or not in JQuery?
- How to parse json in jquery ajax?
- How to Remove Query String from URL using JQuery?
- Check and Uncheck All Checkbox using JQuery Example
- How to access PHP variables in JQuery?
- How can Make an Array from the Values of Another Array's Key Value?
- How to Convert Line Breaks to br in jQuery ?
- How to Check Object is Empty or Not in JQuery?