I have an array list like this
private options: Array<any> = [];
private optionsListDuplicate: Array<any> = [];
let data=[{id:"id",name :"name"},{id:"id2",name:"name"}];
for(let i=0;i<data.length;i++){
    this.options.push({
        label:data[i].name,
        value:data[i].id
    });
    this.optionsListDuplicate.push({
        label:data[i].name,
        value:data[i].id
    });
}
but when i modify the options array object, it modifies optionsListDuplicate object as well. Please help me understand why that happens.
I am adding a new list to the existing options object like this
this.options.push({
            label:"somelabel",
            value:"someid"
        });
I have the requirement that I need to retain the original object. So i did this
this.options=this.optionsListDuplicate;
but this.optionsListDuplicate is having the modified array object
 
     
     
     
    