Javascript does not have a true hashtable object, but through its wierdness, you can use the array as a hashtable. <script type="text/javascript"> var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"]; for(var i=0; i < days.length; i++) { days[days[i]] = days[i]; } document.write("days["Monday"]:"+days["Monday"]); </script> This producesdays["Monday"]:Monday
Javascript
Topic: Js Array
How to use strings as array indexes using JavaScript?
Browse random answers:
What is an Array?
How to Create an Array?
How to Access an Array?
What is the Array Methods and Properties?
What’s a way to append a value to an array?
How will you sort an array using javascript?
What’s a way to append a value to an array?
How tp create Arrays using JavaScript?
How to use strings as array indexes using JavaScript?
How to use "join()" to create a string from an array using JavaScript?
How to make a array as a stack using JavaScript?