Is there a way to clear an object in Javascript? Specifically if an object has several member variables is there a simple way to reset each value?
function exampleObject() {
this.valueA = "A";
this.valueB = "B";
this.myArray = [1,2,3];
}
So basically for an instance of the above reset the three members to empty strings and an empty array? I could easily prototype a member function for the object to do this and call it:
function exampleObject() {
this.valueA = "A";
this.valueB = "B";
this.myArray = [1,2,3];
exampleObject.prototype.resetAll = function() {
this.valueA = "";
this.valueB = "";
this.myArray = [];
}
}
However I want to do this for objects from a third-party library so adding a member function isn't realistic.