jQuery - 获取对象 object 的长度

var bookAuthors = {
    "Farmer Giles of Ham": "J.R.R. Tolkien",
    "Out of the Silent Planet": "C.S. Lewis",
    "The Place of the Lion": "Charles Williams",
    "Poetic Diction": "Owen Barfield"
};
// 获取对象的key值
var arr = Object.keys(bookAuthors);
console.log(arr);
// 获取长度
console.log(arr.length);
返回文章列表 打赏
本页链接的二维码
打赏二维码