Stories

Detail Return Return

JS如何刪除對象中的某一屬性 - Stories Detail

let math = {
    subject: '數學',
    children: [
        { id: 1, title: '數一' }, 
        { id: 2, title: '數二' }, 
        { id: 3, title: '數三' }, 
        { id: 0, title: '待定' }
    ]
}

// 添加新屬性
math.remark = "備註";
// 刪除對象中某一屬性
delete math.subject

結果:

user avatar grewer Avatar yinzhixiaxue Avatar zhaobuhui Avatar u_17443142 Avatar xiaolei_599661330c0cb Avatar assassin Avatar yanyue404 Avatar heath_learning Avatar huanjinliu Avatar cynthia_59675eba1a2ee Avatar hsr2022 Avatar robin_ren Avatar
Favorites 56 users favorite the story!
Favorites

Add a new Comments

Some HTML is okay.