# Searching an array?

**URL:** <https://forum.kirupa.com/t/searching-an-array/224604>\
**Category:** Uncategorized\
**Created:** [May 3, 2007, 5:18pm UTC](https://forum.kirupa.com/t/searching-an-array/224604 "2007-05-03T17:18:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenni\_fur](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jenni\_fur](https://forum.kirupa.com/u/jenni_fur)\
**Post date:** [May 3, 2007, 5:18pm UTC](https://forum.kirupa.com/t/searching-an-array/224604/1 "2007-05-03T17:18:36Z")

</div>

Hey, the following code is from a Kirupa Tutorial, but i was wondering if there was a way of checking once an item is found in the array, where it is located in the array.

ie 20 is coOrdinates [0];

coOrdinates = new Array ();  
coOrdinates.push (20, 21, 22);  
contains = function (input, coOrdinates) {  
for (i=0; i\< coOrdinates.length; i++) {  
if (coOrdinates\* == input) {  
return 1;  
}  
}  
return -1;  
};

if(contains( 20 ,coOrdinates)==1) {  
trace(“I’m here”);
