如何从Javascript对象中删除所有属性?
例如;如果我有以下'class',我怎么能执行重置并删除它的所有属性:
function MyObject()
{
this.type="blah";
this.name="kkjkj";
}
MyObject.prototype.clearAttribs = function()
{
// I want to remove name, type etc from 'this'
// Maybe I can do the following?
for (var key in this)
delete this[key];
}