Array object Index - Node.js Array

Node.js examples for Array:Search

Description

Array object Index

Demo Code


Array.prototype.objectIndex = function(key,value) {
  for(var i = 0, len = this.length; i < len; i++) {
      if (this[i][key] === value) return i;
  }/*from   w w w  .  jav a 2  s  . c  om*/
  return -1;
}

Related Tutorials