var obj = { '1' : 'apple', '2' : 'orange', '3' : 'pear' };
var arrMsg = ['apple', 'orange', 'pear'];
var array = [{'111': 'apple'}, {'222': 'orange'}];
for(var key in obj){
console.log(key); //输出为 1 2 3
console.log(obj[key]);//输出为 apple orange pear
}
for(var (key,value) in obj){
console.log(key); //输出为 1 2 3
console.log(value);//输出为 apple orange pear
}
for(var val in arrMsg){
console.log(val); //输出为 apple orange pear
}
for(var i=0;i<array.length;i++){
var item=array[i];
var key=Object.keys(item);
console.log(item[key]); //输出为 apple orange