You can use indexOf
:
var imageList = [100,200,300,400,500];
var index = imageList.indexOf(200); // 1
You will get -1 if it cannot find a value in the array.
More Related Contents:
- Why Array.indexOf doesn’t find identical looking objects
- Javascript 2d array indexOf
- In an array of objects, fastest way to find the index of an object whose attributes match a search
- Javascript oddness with array of objects and indexOf
- Custom/Modified 'Fibonacci' Number sequence
- Get all non-unique values (i.e.: duplicate/more than one occurrence) in an array
- How to sort an array of objects by multiple fields?
- What is the difference between ( for… in ) and ( for… of ) statements?
- How to add same elements to javascript array n times
- forEach on querySelectorAll not working in recent Microsoft browsers
- How can I convert the “arguments” object to an array in JavaScript?
- forEach on array of undefined created by Array constructor
- How to get subarray from array?
- Alternative or polyfill for Array.from on the Internet Explorer
- How to Compare two Arrays are Equal using Javascript? [duplicate]
- Declare an empty two-dimensional array in Javascript?
- Merge Array of Objects by Property using Lodash
- Why Array.forEach is slower than for() loop in Javascript? [duplicate]
- Array destructuring in JavaScript
- Replace string in javascript array
- How to get an array of unique values from an array containing duplicates in JavaScript? [duplicate]
- Array.includes() to find object in array
- How to use Array.prototype.filter with async?
- An efficient way to get the difference between two arrays of objects?
- Creating an array consisting of the largest values of each sub-array does not work as expected
- Javascript – insert an array inside another array
- split an array into two based on a index in javascript
- Using reduce() to find min and max values?
- How to sum elements at the same index in array of arrays into a single array?
- Map/Set to maintain unique array of arrays, Javascript