动态

详情 返回 返回

js獲取對象的屬性個數 - 动态 详情

let math = {
    subject: '數學',
    children: [
        { id: 1, title: '數一' }, 
        { id: 2, title: '數二' }, 
        { id: 3, title: '數三' }, 
        { id: 0, title: '待定' }
    ]
}
// 取對象的屬性個數
Object.getOwnPropertyNames(math).length;
Object.keys(math).length;
user avatar toopoo 头像 zourongle 头像 linx 头像 anchen_5c17815319fb5 头像 hard_heart_603dd717240e2 头像 jiavan 头像 yqyx36 头像 yangxiansheng_5a1b9b93a3a44 头像 congjunhua 头像 DolphinScheduler 头像 morimanong 头像 wubomu 头像
点赞 51 用户, 点赞了这篇动态!
点赞

Add a new 评论

Some HTML is okay.