标签云

微信群

扫码加入我们

WeChat QR Code

This question already has an answer here:

I have a object like this.

var Obj = {
    obj1 : {
        val : 1,
        id : 1
    }
    obj2 : {
        val : 2,
        id :2
    }
    obj3 : {
        val : 3,
        id :3
    }
}

I want to delete obj1, can anybody suggest how to achieve this.


This is invalid object!

2018年07月23日09分50秒

DhavalMarthak If I make obj=1 then is it valid ?

2018年07月23日09分50秒

CarlosRivero But in my case it is attributes are dynamic, I can not randomly delete any specific attribute

2018年07月23日09分50秒

Surely you just use the dot notation and set it to undefined? Obj.obj1 = undefined?

2018年07月23日09分50秒

thanks, or any way by I can retrieve as a loop

2018年07月23日09分50秒