I'm creating a copy of a JS object in order to perform functions on the copy. However, I'm unable to call the functions in the copied object, I just get an error saying that the functions do not exist in this instance, any ideas?
edit: here is the code
obj.isGridStateSolvable();
let tempobj = jQuery.extend(true, {}, obj);
tempobj.isGridStateSolvable();
Line one is working correctly and the function is accessible however the third line is not.
edit 2: here is a testable example
class Num{
constructor(numParam){
this.number = numParam;
}
incrementNum(){
this.number++;
}
}
var num1 = new Num(5);
num1.incrementNum();
console.log(num1); //Outputs 6 as expected
let num2 = jQuery.extend(true, {}, num1);
num2.incrementNum(); //This function does not exist