JavaScript does not support Associative array. Arrays in JavaScript work with numbered indexes. Here is an example −
Example
<!DOCTYPE html> <html> <body> <p id="test"></p> <script> var dept = []; dept[0] = "Amit"; dept[1] = "Technical"; dept[2] = 045; document.getElementById("test").innerHTML = dept[1] + " " + dept.length; </script> </body> </html>