Friday, October 17, 2014

Write A program to use of Associative Array in javascript.


Write A program to use of Associative Array in javascript.
Code : asso-array.html

<html>
<body>
<script type="text/javascript">
/* Associative Array */
var a={Name:"ABC" , Rollno:25 , Class:"B"};
document.write(a["Name"] + "<br>" + a["Rollno"] + "<br>" + a["Class"] +"<br>");
document.write("<br><br><br>");
/* Multidimentional Array */
var ma=new Array(["LAN","WAN","MAN"],["BUS","STAR","RIGN","TREE"],
["DATA","SIGNAL","SIGNALING","TRANSMISSION"]);
document.write(ma[0] + " <br>");
document.write(ma[1] + " <br>");
document.write(ma[2] + " <br>");
</script>
</body>
</html>

No comments: