Deep copying is affecting both the arrays

Viewed 38

I'm having two objects(say obj1 and obj2) If I change obj1 it is affecting in obj2 also. I'm trying to change the multiple['w']=10. Is there any way for copying object without affecting in second object i.e obj2

let obj1={ 
  "director":{
    "data":[
      "multiple":{
        "w":1
      }
     ]
   }
}

let obj2={...a}

0 Answers
Related