About 50 results
Open links in new tab
  1. javascript - 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 is an …

  2. Find a value in an array of objects in Javascript [duplicate]

    Sep 17, 2012 · I know similar questions have been asked before, but this one is a little different. I have an array of unnamed objects, which contain an array of named objects, and I need to get the object …

  3. How to find first element of array matching a boolean condition in ...

    May 5, 2012 · The closest thing I can find is Array.prototype.some which tries to find if some element satisfies a given condition you pass to it in the form of a function. Unfortunately, this returns a …

  4. Find the min/max element of an array in JavaScript

    The following function uses Function.prototype.apply() to find the maximum element in a numeric array. getMaxOfArray([1, 2, 3]) is equivalent to Math.max(1, 2, 3), but you can use getMaxOfArray() on …

  5. Get JavaScript object from array of objects by value of property

    Find the value of the first element/object in the array, otherwise undefined is returned.

  6. javascript - How can I find and update values in an array of objects ...

    The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. N.B : In case you're working with reactive frameworks, it will update …

  7. How to find the indexes of all occurrences of an element in array?

    Dec 27, 2013 · I am trying to find the indexes of all the instances of an element, say, "Nano", in a JavaScript array.

  8. How do I check if an array includes a value in JavaScript?

    Array.prototype. indexOf -> (returns index or -1) is generally used for finding index of element in array. This can also be used for searching object but only works if you are passing reference to same object.

  9. Search an array of JavaScript objects for an object with a matching ...

    myArray.find(x => x.id === '45').foo; From MDN: The find() method returns the first value in the array, if an element in the array satisfies the provided testing function. Otherwise undefined is returned.

  10. How can I remove a specific item from an array in JavaScript?

    How do I remove a specific value from an array? Something like: array.remove(value); Constraints: I have to use core JavaScript. Frameworks are not allowed.