Re: Best way to find if item is in array?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Best way to find if item is in array?

From: ASM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date: Wed Aug 31 2005 - 22:09:32 CEST

Jim Davis wrote:
>
> And if it IS very large or you search it a lot why not set up a hash table?
> Then it's just "if ( myHash["Jane"] ) {};" Instant results with no fuss.
>
> Just my opinion of course - which doesn't change the fact that McKirahan's
> solution will, indeed, work just fine. ;^)

tbl = new Array("frank", "jim'n'jane", "moriaux", "toto", "foo");

alert(tbl['toto']);

returns : undefined

-- 
Stephane Moriaux et son [moins] vieux Mac
Received on Tue Oct 18 03:15:30 2005