Stories

Detail Return Return

js獲取對象的屬性個數 - Stories Detail

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 Avatar zourongle Avatar linx Avatar anchen_5c17815319fb5 Avatar hard_heart_603dd717240e2 Avatar jiavan Avatar yqyx36 Avatar yangxiansheng_5a1b9b93a3a44 Avatar congjunhua Avatar DolphinScheduler Avatar morimanong Avatar wubomu Avatar
Favorites 51 users favorite the story!
Favorites

Add a new Comments

Some HTML is okay.