Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i initialize array's data at declaration? 1

Status
Not open for further replies.

sacosta

Programmer
Apr 10, 2000
3
US
Can I put data into an array at the moment I declare it?<br>I've tried this, but I get an error (missing ; )<br><br>var weekend[3] = {&quot;friday&quot;,&quot;saturday&quot;,&quot;sunday&quot;};<br>document.write(weekend[0]);<br>
 
try something like this:<br><br>var myArr=new Array(stuff,seperated,by,commas);<br><br>if you just want to set the maximum number of slots, use:<br><br>var myArr=new Array(numSlots);<br><br>//numSlots must be less than 99 <p>theEclipse<br><a href=mailto:eclipse_web@hotmail.com>eclipse_web@hotmail.com</a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>**-Trying to build a documentation of a Javascript DOM, crossbrowser, of course. E-mail me if you know of any little known events and/or methods, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top