Seasons123 / blog-FE

web前端相关issue is my blog :lollipop:
2 stars 0 forks source link

js取json对象的键和值 #101

Closed Seasons123 closed 5 years ago

Seasons123 commented 5 years ago
//构建一个json对象  
var jb={"美的":49,"三星":35,"海信":25,"格力":16,"方太":14};  
for(var key in jb){  
  alert(key); //json对象的key  
  alert(jb[key]); //json对象的值  
}