![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.javascript archiveRe: Best way to find if item is in array?
From: ASM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date: Wed Aug 31 2005 - 17:36:42 CEST
J. B. Moreno wrote:
error ! have had to read :
alert(myArray.join().indexOf(myValue));
> I think I understand that, but let me test my understanding:
no
if it finds it returns '1'
so for true/false :
alert(myArray.join().indexOf(myValue)>=0)
that's to say :
if(myArray.join().indexOf(myValue)>=0) alert('true');
> That's not actually a show stopper in this case...but I might have to do
a demo ?
<html>
tbl = new Array("frank", "jim'n'jane", "moriaux", "toto", "foo");
alert(tbl.join().indexOf('ri')>=0);
function verif(myArray,myValue) {
document.write('array = "tbl"<br>content = '+tbl.join()+
-- Stephane Moriaux et son [moins] vieux MacReceived on Tue Oct 18 03:15:15 2005 |