views:

27

answers:

1

Hey all,

Google wasn't my friend on this one... maybe I wasn't searching for the right terms.

I have a javascript array randomTagLine[0], randomTagLine[1], etc. How do I get the total number of variables in the array? For instance, I can physically see there are 23, but I need to pull that out via JS code...

Thanks in advance..

EDIT

Example of code:

var randomTagline = new Array();
randomTagline[0] = "TEXT0";
randomTagline[1] = "TEXT1";
randomTagline[2] = "TEXT2";
//...
randomTagline[23] = "TEXT23";
var randomTaglineLength = randomTagLine.length;

var randomTaglineNum = randomXToY(0,randomTaglineLength,0);

alert(randomTaglineNum + " " + randomTaglineLength);
+4  A: 

It's :

 var length = randomTagLine.length;
Squ36
I'm getting a `randomTagLine is not defined` on that, even though it's defined earlier as `var randomTagline = new Array();` any ideas?
Jared
Can you post a little more code ? Like for example, where are you defining the array, filling it, and testing the length ?
Squ36
Found it... it was an "L" instead of a "l"... Thanks for your help!
Jared
You got it like 2 seconds before me :p
Squ36