1、json中输出各个键值:
1 var ohp = {"星期一":18,"星期二":16,"星期三":19,"星期四":11,"星期五":99,"星期六":0,"星期日":0}; 2 for(var key in ohp){ 3 console.log(key); 4 console.log(ohp[key]); 5 }
2、查询星期五的值: 1 console.log(ohp["星期五"]); //星期五的值
1、json中输出各个键值:
1 var ohp = {"星期一":18,"星期二":16,"星期三":19,"星期四":11,"星期五":99,"星期六":0,"星期日":0}; 2 for(var key in ohp){ 3 console.log(key); 4 console.log(ohp[key]); 5 }
2、查询星期五的值: 1 console.log(ohp["星期五"]); //星期五的值