Copy the code code as follows:
//Arrays in js can exist in the form of key-value pairs
var arr = new Array();
arr["A"] = "boss";
arr["B"] = "Emp";
for (var m in arr) {
document.write(arr[m] + " ");
}
var person = new Object();
person["name"] = "xiaoli";
person["age"] = "18";
person["salary"] = "1888.9";
for (var p in person) {
document.write(person[p] + "<br>");
}
//Does the test use the age attribute?
if (typeof person["age"] == "undefined") {
document.write("no");
}