<p>How do I remove all attributes which are <code>undefined</code> or <code>null</code> in a JavaScript object?</p>

<p>(Question is similar to <a href="https://stackoverflow.com/questions/208105/how-to-remove-a-property-from-a-javascript-object">this one</a> for Arrays)</p>

You are probably looking for the
```
delete
```
keyword.
```
```
var obj = { };
obj.theProperty = 1;
delete obj.theProperty;
```
```