动态

详情 返回 返回

JS如何刪除對象中的某一屬性 - 动态 详情

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

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

結果:

user avatar grewer 头像 yinzhixiaxue 头像 zhaobuhui 头像 u_17443142 头像 xiaolei_599661330c0cb 头像 assassin 头像 yanyue404 头像 heath_learning 头像 huanjinliu 头像 cynthia_59675eba1a2ee 头像 hsr2022 头像 robin_ren 头像
点赞 56 用户, 点赞了这篇动态!
点赞

Add a new 评论

Some HTML is okay.