How do I identify an item in a hash array if the key of the array is only known within a variable? For example:
var key = "myKey";
var array = {myKey: 1, anotherKey: 2};
alert(array.key);
Also, how would I assign a value to that key, having identified it with the variable?
This is, of course, assuming that I must use the variable key to identify which item in the array to alert.
Thanks in advance!