To access the properties of an object without knowing the names of those properties you can use a for ... in
loop:(要在不知道这些属性的名称的情况下访问对象的属性,可以使用for ... in
循环:)
for(key in data) {
if(data.hasOwnProperty(key)) {
var value = data[key];
//do something with value;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…