JavaScript: Array.prototype.findIndex

By Xah Lee. Date: . Last updated: .

New in JS2015.

See Array.prototype.find

const isEven = (x => ( x % 2 === 0 ? true : false ) )

console.log( [7,3,4,2].findIndex (isEven) ); // 2

// if not found, return undefined
console.log( [1,3,5].find (isEven) ); // undefined

JS Array Search

JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Array

prototype