loop throught all members of an object in javascript

This question already has an answer here:

  • How to loop through a plain JavaScript object with the objects as members? 17 answers

  • I have created a jsfiddle for you at http://jsfiddle.net/5eM4q/

    The way you access the data using

        data[obj].country
    

    is incorrect


    For the solution you can check out this demo.

    DEMO

    You can loop Object using for(k in obj)

    for(k in obj){
        var value = obj[k];
    }
    
    链接地址: http://www.djcxy.com/p/51998.html

    上一篇: 阅读没有方括号的JSON数组

    下一篇: 在javascript中循环遍历一个对象的所有成员