Remove duplicate item from array Javascript

<>

This question already has an answer here:

Answers


Why do it the hard way, it can be done more easily using javascript filter function which is specifically for this kind of operations:

var arr = ["apple", "bannana", "orange", "apple", "orange"];

arr = arr.filter( function( item, index, inputArray ) {
           return inputArray.indexOf(item) == index;
    });


---------------------
Output: ["apple", "bannana", "orange"]

Need Your Help

Error With building CEF in Windows

c chromium chromium-embedded

I'm trying to build CEF branch 1180 on windows with Visual Studio 2010, but i get this problem when building for the first time.

Exporting data to excel in C# with comma delimited issue

c# excel

The problem is not the exporting itself but how it separates the fields with comma's and I have commas in the fields. All works fine until it gets to the last field where the string contains a comm...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.