如何获取JSON有多少个字段,JSON子项的个数或叫length
<script type="text/javascript">
var myObject = {'name':'Kasun', 'address':'columbo','age': '29'}
var count = Object.keys(myObject).length;
console.log(count);
</script>
Object.keys().length 就👌
如何获取JSON有多少个字段,JSON子项的个数或叫length
<script type="text/javascript">
var myObject = {'name':'Kasun', 'address':'columbo','age': '29'}
var count = Object.keys(myObject).length;
console.log(count);
</script>
Object.keys().length 就👌
本文标题:2020-09-05
本文链接:https://www.haomeiwen.com/subject/demxektx.html
网友评论