Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] RE: array.indexOf
From: Phillip Kerman
Date: Mon, 29 Jan 2001 16:32:28 -0000

You could also just write a loop that goes through each item in the array
until it finds what you're looking for... then note what index it was found
in.

It may seem like a slow proposition (stepping through as many as all the
items) but arrays are generally very fast to search through.

Here's the pseudo-code:

searchFor="thing I'm looking for";

for (i in myarray){
if (i==searchFor){
break;
}
}
trace("it was found in spot "+ i);




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]