About 814,000 results
Open links in new tab
  1. In Javascript, how do I check if an array has duplicate values?

    Sep 2, 2015 · If you only need string values in the array, the following will work: function hasDuplicates(array) { var valuesSoFar = Object.create(null); for (var i = 0; i < array.length; …

  2. JavaScript Program to Find Duplicate Elements in an Array

    Apr 7, 2025 · In JavaScript, array methods such as filter () and indexOf () can be used to find duplicates in a concise way. filter () creates a new array containing elements that satisfy a …

  3. Check if an Array contains Duplicates in JavaScript - bobbyhadz

    Mar 2, 2024 · Use the Array.some() method to iterate over the array. Check if the index of the first occurrence of the current value is NOT equal to the index of its last occurrence. If the condition …

  4. Find Duplicate Values in a JavaScript Array - Online Tutorials …

    Learn how to find duplicate values in a JavaScript array with this comprehensive guide, including examples and step-by-step instructions.

  5. Find duplicates in an array using javaScript - Flexiple

    Mar 14, 2022 · To find duplicates in an array using JavaScript, combining the filter() and indexOf() methods provides an elegant solution. The filter() method creates a new array with all …

  6. How to find duplicates in an array using JavaScript

    Jul 3, 2021 · Learn how to check if an array contains duplicate values using indexOf (), set object, and iteration in JavaScript.

  7. Check duplicate values in javascript array in 5 ways - codippa

    Mar 24, 2020 · Learn 5 different ways to check if an array contains duplicate elements with example and explanation.

  8. javascript - How can I check if the array of objects have duplicate ...

    Jun 9, 2015 · To find all duplicates in a JavaScript array of objects based on a specific property (in this case, "name"), you can use a combination of reduce() and filter() functions.

  9. Find duplicate elements in an array - GeeksforGeeks

    Dec 19, 2024 · Given an array of n integers. The task is to find all elements that have more than one occurrences. The output should only be one occurrence of a number irrespective of the …

  10. 3 ways to remove duplicates in an Array in Javascript

    Sep 7, 2021 · To eliminate duplicates, the filter () method is used to include only the elements whose indexes match their indexOf values, since we know that the filer method returns a new …

  11. Some results have been removed
Refresh