Skip to content

Instantly share code, notes, and snippets.

@girasquid
Created June 22, 2013 01:59
Show Gist options
  • Save girasquid/5835518 to your computer and use it in GitHub Desktop.
Save girasquid/5835518 to your computer and use it in GitHub Desktop.
function MatrixIndexOf(matrix, object) {
for(var i = 0; i < matrix.length; i++) {
for(var j = 0; j < matrix[i].length; j++) {
if(matrix[i][j] === object) {
return [i, j];
}
}
}
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment