|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Article Discussion: Defining JavaScript Arrays Using Literal Notation
If you have any questions or comments on this article then please post them here.
This forum post relates to this article.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#2
|
|||
|
|||
|
Re: Article Discussion: Defining JavaScript Arrays Using Literal Notation
Hi,
Nice introduction to the javascript world of literals. While its not an overly complex topic, alot javascript programmers simply don't know that its an option. Thanks. This method of coding lends itself to quick solutions. The less typing the better, as soon as the ideas come, you can see the results. There's no use declaring an Array object every time you want a stack or collection, javascript already does that behind the scenes. I think its also easier to read, as well. I have a soft spot for this method of coding. It brings me back to my C++ training. If you started out in this type of environment, literal declaration of arrays in javascript are only natural. And it makes you realize that there's certain things within the language that stem more from C++ than Java. Thanks Again, -Terry |
|
#3
|
|||
|
|||
|
This literal notation code does not work for me using IE 6
I used the following code for this to work. I had to enclose each dimensions set of values in of their own set of brackets and each individual value in a set of quotation marks .
The code at the bottom gives you the following results.... inside1,inside2,inside3 middle1,middle2,middle3 outside1,outside2,outside3 Hope this helps someone, peace. <html> <head> <title>Untitled</title> </head> <body> <script language="JavaScript" type="text/javascript"> <!--This is for a literal array multidimensional//--> var myarray=[["inside1", "inside2", "inside3"], ["middle1", "middle2", "middle3"], ["outside1", "outside2", "outside3"]]; str1 = myarray.join(" "); document.write(str1); </script> </body> </html> Last edited by drlebey : August 16th, 2004 at 08:24 PM. Reason: To better describe the reply |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Article Discussion: Defining JavaScript Arrays Using Literal Notation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|