热门

最新

红包

立Flag

投票

同城

我的

发布
laoyuanwailk
laoyuanwailk
4 年前
truelaoyuanwailk

<script>
var obj={
name : "jack",
age : 20,
location: "dalian"
}

// document.write("name:"+obj.name)
// document.write("<br>")
// document.write("age:"+obj.age)
// document.write("<br>")
// document.write("location:"+obj.location)
// document.write("<br>")

for(var i in obj){
// 获取key
console.log(i)
// 获取value
console.log(obj[i])
document.write(i+":"+obj[i])
document.write("<br>")
}
</script>

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
新手小白 看网上教程想练一下这个代码但是出现错误应该如何改正?
立即登录