Skip to content

Instantly share code, notes, and snippets.

@anewusername1
Created August 26, 2011 16:46
Show Gist options
  • Save anewusername1/1173834 to your computer and use it in GitHub Desktop.
Save anewusername1/1173834 to your computer and use it in GitHub Desktop.
array index searching
// search through a two dimensional array
Array.prototype.findIndexByCol = function(value,cIdx){
for (var i=0; i < this.length; i++) {
// use === to check for Matches. ie., identical (===), ;
if (this[i][cIdx] == value) {
//alert(this[i][cIdx]+"===="+value);
return i;
}
}
return null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment