Use string as the array indexer : String Indexer « Array « JavaScript Tutorial






<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>








11.7.String Indexer
11.7.1.Array String Indexes
11.7.2.Use string as the array indexer