Solved

Array Counter

Posted on 2000-03-05
3
415 Views
Last Modified: 2012-06-27
Anyone know a quick way to count the number of two dimensional arrays in a script?  i.e. foo[0], foo[1], foo[2], foo[x] - I'm looking for a method to find what 'x' goes up to, is there a built-in function to do this in javaScript?

I like to avoid recursion. Thanks.
dog42
0
Comment
Question by:dog42
  • 2
3 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 2585217
foo.length()
0
 
LVL 19

Accepted Solution

by:
daveamour earned 100 total points
ID: 2585224
Aplogies on my last comment

You don't need the ()

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>
<Script Language="JavaScript">
<!--
  x = new Array ("asdawd","adasdasd","dsffgdgd");
  alert (x.length);
//-->
</Script>
</body>

</html>
0
 
LVL 2

Author Comment

by:dog42
ID: 2585233
Thanks.  I thought it was going to be more complicated than that!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now