title: How to test whether object "isEmpty()" if Object.prototype was modified?
body: <p>I want to test whether an object is empty: <code>{}</code>. The following is typically used:</p>
  
  <pre><code>function isEmpty(obj) {
    for (var prop in obj) {
      if (obj.hasOwnProperty(prop))
        return false;
    }
    return true;
  }
  </code></pre>
  
  <p>But suppose the <code>Object</code> prototype was added to as follows:</p>
  
  <pre><code>Object.prototype.Foo = "bar";
  </code></pre>
  
  <p>Tests:</p>
  
  <pre><code>alert(isEmpty({}));              // true
  Object.prototype.Foo = "bar";
  alert({}.Foo);                   // "bar" oh no...
  alert(isEmpty({}));              // true  ...**huh?!**
  </code></pre>
  
  <p>I tried to nuke the object's prototype, change it's constructor, and all manner of such hacks. Nothing worked, but maybe I did it wrong (probable).</p>