转载出处:https://blog.csdn.net/xm_csdn/article/details/78431879
对象长度
- 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"
- };
- var arr = Object.keys(bookAuthors);
- console.log(arr);
- console.log(arr.length);
数据长度
- var arr = ["zuojj", "benjamin", "www.zuojj.com"];
- console.log(Object.keys(arr));
- console.log(arr.length);
计算对象的长度
原文:https://www.cnblogs.com/wanlibingfeng/p/9186597.html