About 52 results
Open links in new tab
  1. How do I check if an array includes a value in JavaScript?

    What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) { for (var i = 0; i < a.length;...

  2. Check if an array contains any element of another array in JavaScript

    May 1, 2013 · Array .filter() with a nested call to .find() will return all elements in the first array that are members of the second array. Check the length of the returned array to determine if any of the …

  3. javascript - Array.includes () to find object in array - Stack Overflow

    72 This question already has answers here: Javascript: Using `.includes` to find if an array of objects contains a specific object (7 answers)

  4. Determine whether an array contains a value - Stack Overflow

    Jul 25, 2009 · $.inArray(value, array) Returns index of value in array. Returns -1 if array does not contain value. See also How do I check if an array includes an object in JavaScript?

  5. How to determine if a JavaScript array contains an object with an ...

    When you wrote this answer, the title was “How to determine if Javascript array contains an object with an attribute that equals a given value?”. You’re checking if an object has a property on its prototype …

  6. Check if a string contains any element of an array in JavaScript

    May 25, 2016 · 72 How can I check if a string contains any element of an array? I want to filter some array if the element has some string. Please see below code.

  7. array.contains (array) in JavaScript - Stack Overflow

    Oct 9, 2014 · Is there an easy way of knowing if and array contains all elements of another array? Example: var myarray = [1,2,3]; var searchinarray = [1,2,3,4,5]; searchinarray contains all elements …

  8. Javascript array contains/includes sub array - Stack Overflow

    Dec 8, 2015 · I need to check if an array contains another array. The order of the subarray is important but the actual offset it not important. It looks something like this: var master = [12, 44, 22, 66, 222,...

  9. Javascript: Using `.includes` to find if an array of objects contains a ...

    Mar 9, 2018 · Javascript: Using `.includes` to find if an array of objects contains a specific object Asked 7 years, 11 months ago Modified 2 years, 11 months ago Viewed 42k times

  10. javascript - Check if an element is present in an array - Stack Overflow

    811 This question already has answers here: How do I check if an array includes a value in JavaScript? (64 answers)