var obj={"name":"wjy","age":26,"sex":"female"};//定义一个object对象 var keys=[];//定义一个数组用来接受key var values=[];//定义一个数组用来接受value for(var key in obj){ keys.push(key); values.push(obj[key]);//取得value alert(eval("obj."+key));//循环内逐一打印value值 } alert(obj.name);//wjy alert("keys is :"+keys+" and values is :"+values); //keys is : name,age,sex and values is : wjy,26,female
1 for (var i in data.data_info) { 2 console.log(data.data_info[i]); 3 console.log(i); 4 };