About 225,000 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 · Vanilla JS const found = array1.some(r=> array2.includes(r)) How it works some(..) checks each element of the array against a test function and returns true if any element of the …

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

    As of JULY 2018, this has been implemented in almost all major browsers, if you need to support an older browser a polyfill is available. Edit: Note that this returns false if the item in the array …

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

    Jul 25, 2009 · jQuery has a utility function for this: $.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 …

  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 …

  6. How to find if an array contains a specific string in …

    Does this answer your question? How do I check if an array includes a value in JavaScript?

  7. Check whether a value exists in JSON object - Stack Overflow

    Below function can be used to check for a value in any level in a JSON function _isContains(json, value) { let contains = false; Object.keys(json).some(key => { contains = typeof json[key] === …

  8. javascript - Check if array contains all elements of another array ...

    Jul 12, 2020 · The every() method tests whether all elements in the array pass the test implemented by the provided function. It returns a Boolean value. Stands to reason that if you …

  9. Use Javascript to check if JSON object contain value

    Nov 5, 2016 · I want to check if a certain key in a JSON object like the one below contains a certain value. Let's say I want to check if the key "name", in any of the objects, has the value …

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

    Mar 9, 2018 · The includes() method determines whether an array includes a certain element, returning true or false as appropriate. But in the way you are comparing two objects they are …

Refresh