# Get (two-dimensional) array position

**URL:** <https://forum.kirupa.com/t/get-two-dimensional-array-position/121055>\
**Category:** Uncategorized\
**Created:** [August 30, 2004, 3:13pm UTC](https://forum.kirupa.com/t/get-two-dimensional-array-position/121055 "2004-08-30T15:13:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forum.kirupa.com/u/bape)\
**Post date:** [August 30, 2004, 3:13pm UTC](https://forum.kirupa.com/t/get-two-dimensional-array-position/121055/1 "2004-08-30T15:13:19Z")

</div>

I found the tutorial about getting the index of something in an array, but i need the same for a twodimensional array, so i get [0][1] for example. How do i alter this code to do so?

```auto
Array.prototype.getIndex = function(data) {
 for (i=0; f=0; i<this.length; ++i; ) {
  if (this* == data) {
   return i;
  }
 }
 return -1;
}; 

```
