//for in循环遍历
var objs={"username":"hh","age":"20","sex":"boy"}
for(i in objs){
console.log(i); //uesername age sex
console.log(objs[i]); //hh 20 boy 这里用括号不用点读取属性的原因是:i可能为数字,点可能会被当做小数点来对待
}

相关文章:

  • 2021-08-21
  • 2021-05-03
  • 2022-12-23
  • 2021-11-26
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2021-08-01
  • 2022-02-01
  • 2022-02-08
  • 2021-07-02
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案