# indexOf() not working

**URL:** <https://forum.kirupa.com/t/indexof-not-working/266860>\
**Category:** Uncategorized\
**Created:** [July 24, 2008, 11:29pm UTC](https://forum.kirupa.com/t/indexof-not-working/266860 "2008-07-24T23:29:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [July 24, 2008, 11:29pm UTC](https://forum.kirupa.com/t/indexof-not-working/266860/1 "2008-07-24T23:29:45Z")

</div>

I have a search field that is searching an array:

```auto

for (i=0; i< searchStrings_ar.length; i++) {
	index = searchStrings_ar*.toLowerCase().indexOf(searchCriteria);
	 if( index > -1 ) {
		searchResults_ar.push(i+1);
	}
}

```

Their is a data in the searchStrings array, I know that. If I trace out index, I get all of them undefined???

searchCriteria is just a variable of searchfield.text;

so nothing passed is getting undefined until I try and trace out index. Anyone have an idea?
