How to remove an attribute of a nested object

I have such an object.

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

I want to remove obj1, can anyone suggest how to achieve this.

+5
source share
1 answer

Use the delete keyword

 delete Obj.obj1 
+2
source

Source: https://habr.com/ru/post/1262988/


All Articles