当前位置:编程学习 > JS >>

js中for in输出数组中属性名和属性值

[html]
<span style="font-size:18px;"><html> 
<head> 
    <script> 
        var person = { 
            name:"suesunna", 
            age:22, 
            love:"coding" 
        }; 
         
        for(var i in person){ 
            document.write("this person's "+i+" is "+person[i] +"<br/>"); 
        } 
    </script> 
</head> 
 
<body> 
</body> 
</html></span> 
补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,