js foreach get array key code example
Example: js loop through associative array
var months = [];
months["jan"] = "January";
months["feb"] = "February";
months["mar"] = "march";
for (var key in months) {
var value = months[key];
console.log(key, value);
}