Hi Guys,
It is always good to have a associated arrays instead of plain arrays in java java script. The below sample code demonstrates the use of java script associated arrays.
It is always good to have a associated arrays instead of plain arrays in java java script. The below sample code demonstrates the use of java script associated arrays.
var gameNdPlayesr= new Array();
gameNdPlayesr["cricket"]="Sachin";
gameNdPlayesr["football"]="Maradona";
gameNdPlayesr["golf"]="Woods";
var sport=confirm("Please enter your favourite sport");
alert( "The king of "+ sport+" is "+gameNdPlayesr[sport]);
Thanks,
Rajesh Kumar Yuvaraj