I am copying myObj to tempMyObj
myObj
tempMyObj
var tempMyObj = myObj;
tempMyObj.entity is an array of objects. I am
tempMyObj.entity
Try using the create() method like as mentioned below.
var tempMyObj = Object.create(myObj);
This will solve the issue.