//建立对象
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.length)
js获取对象长度
原文链接:js获取对象长度,转发请注明来源!
评论已关闭。


