I'm attempting to reference a value in an array through the use of a variable.
So, given myarray
, I can do the following just fine:
alert(myarray[1].hp_id);
The contents I'm after comes out just fine.
However, if I want to put hp_id
in a variable, it doesn't work so well.
var array_col = hp_id;
alert(myarray[1].array_col);
How might I be able to make reference to an array value by using a variable?
Many thanks in advance.