For each & Associative Arrays

Defining Associative Arrays

var s_list = new Array();
s_list[“tall”] = “Thomas”;
s_list[“cool”] = “Roger”;
s_list[“clever”] = “Amber”;
s_list[“attentive”] = “Jennifer”;

For each

for each(student in s_list) {
document.write(student + “
“);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.