1// for enumerable and non-enumerable of an object with proto chain
2var props = Object.getOwnPropertyNames(obj);
3for (var i = 0; i < props.length; i++) {
4 delete obj[props[i]];
5}
6
7// for enumerable properties of shallow/plain object
8for (var key in obj) {
9 // this check can be safely omitted in modern JS engines
10 // if (obj.hasOwnProperty(key))
11 delete obj[key];
12}