开发者

How to get total number of variables in an array in Javascript?

开发者 https://www.devze.com 2023-01-11 22:06 出处:网络
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

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();
randomTag开发者_Python百科line[0] = "TEXT0";
randomTagline[1] = "TEXT1";
randomTagline[2] = "TEXT2";
//...
randomTagline[23] = "TEXT23";
var randomTaglineLength = randomTagLine.length;

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

alert(randomTaglineNum + " " + randomTaglineLength);


It's :

 var length = randomTagLine.length;
0

精彩评论

暂无评论...
验证码 换一张
取 消