json in the key acquisition method for quantity, not cycle

var obj = {
            one: 1,
            two: 2,
            three: 3
        };  
        $.each(obj, function(key, val) {
            console.log(key); 
            console.log(val);  
        });
        console.log(Object.keys(obj).length)

Only a Object.keys (obj) method to get the .length

Guess you like

Origin www.cnblogs.com/liubeiblog/p/10949714.html