# Array not working!?!?

**URL:** <https://forum.kirupa.com/t/array-not-working/213452>\
**Category:** Uncategorized\
**Created:** [January 19, 2007, 6:04pm UTC](https://forum.kirupa.com/t/array-not-working/213452 "2007-01-19T18:04:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kredd](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kredd](https://forum.kirupa.com/u/kredd)\
**Post date:** [January 19, 2007, 6:04pm UTC](https://forum.kirupa.com/t/array-not-working/213452/1 "2007-01-19T18:04:10Z")

</div>

hello all,  
i’ve got an array of states and a textfield for a user to type his/her state and press “search”.

i can trace the array and see all the values and i can trace the textfield value of the user and everything is showing up. but…

i can’t match the user input with the correspoding state in the array. as simple as this is the code below isn’t working:

```auto
 
searcher.srch.onRelease = function() // fires when the search btn is released
{
 var s = searcher.userState.text; // user input txtfld
 
 for(var a=0; a<lArray.length; a++) //lArray is the array of states
 {
  if(s == lArray[a]) // if the user's input matches a value in the array, then...
  {
   trace("found it!");
  }
else
  {
   trace("not found!");
  }
 }
}

```

if i use “==” i get ‘not found’, if i use “=” i get “found it”…regardless of what i search for. i can search for ‘chicken’ and it will find it…which is impossible.

any ideas?? :ear:  
thanks!
