获取对象长度
var obj = {"a1":1,"a2":2};
var arr = Object.keys(obj); // arr = ["a1","a2"];
var len = arr.length;
console.log(len); //结果为2
获取对象长度
var obj = {"a1":1,"a2":2};
var arr = Object.keys(obj); // arr = ["a1","a2"];
var len = arr.length;
console.log(len); //结果为2