Mega Code Archive

 
Categories / JavaScript Tutorial / Array
 

Use string as the array indexer

< html> <head> <title>Mixing Notations</title> <script language="javascript" type="text/javascript"> <!-- var x = new Array(); x["first"]  = "1st"; x["second"] = "2nd"; x["third"]  = "3rd"; alert(x.first + ", " + x.second + ", " + x.third); //--> </script> </head> <body> <h1>Mixing Notations</h1> </body> </html>