Node.js examples for Array:Search
Find index of particular value within an array
/**// ww w. jav a 2 s. c o m * find index of particular value within an array * * @param {String} query * the value to search for within array * * @return {Number} index of object within array * */ Array.prototype.findIndex = function(query) { for (var i=this.length-1; i>=0; i--) { if (this[i].toLowerCase() === query.toLowerCase()) { break; } } return i; };