How to remove all attributes from a Javascript object?
For instance; if I have the following “class”, how can I reset and remove all its attributes:
function MyObject()
{
this.type="blah";
this.name="kkjkj";
}
MyObject.prototype.clearAttribs = function()
{
for (var key in this)
delete this[key];
}
source
share