Forum Moderators: open
var keys = ['one', 'two', 'three'];
var values = ['red', 'blue', 'green'];
var keys = ['one', 'two', 'three'];
var values = ['red', 'blue', 'green'];
var hashMap = {},
i,
n;
for (i = 0, n = keys.length; i < n; i++) {
hashMap[keys[i]] = values[i];
}
alert(hashMap['two']);
I have to use an Array not an Object
I'm not sure if I can determine the key number of the array item and then reference that same number to the second array.Yes you can JAB. Use indexOf().