I am new to JS constructor functions. I have an object/constructor. The function takes data as a property. However I need two copies of the data: one to change and then one as a reference to reset to. However, changing one seems to change the other no matter what:
var myData = [1, 2, 3, 4, 5]
myFunction(myData)
function myFunction(data){
this.updatableData = data;
this.resetData = data;
this.updatableData.pop()
console.log(this.resetData)
//expect [1,2,3,4,5]
//but get [1,2,3,4]
}