title: Why is document.all defined but typeof document.all returns "undefined"?
body: <p>I was doing some research on JavaScript's <code>typeof</code> operator, and stumbled across the following weirdness:</p>
  
  <blockquote>
    <h1>Exceptions</h1>
    
    <p>All current browsers expose a non-standard host object <code>document.all</code> with type Undefined.</p>
  
  <pre><code>typeof document.all === 'undefined';
  </code></pre>
    
    <p>Although the specification allows custom type tags for non-standard exotic objects, it requires those type tags to be different from the predefined ones. The case of <code>document.all</code> having type tag <code>'undefined'</code> must be classified as an exceptional violation of the rules.</p>
  </blockquote>
  
  <p>(<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof" rel="noreferrer">Source</a>)</p>
  
  <p>I set up the following in my browser to test it:</p>
  
  <pre><code>console.log("typeof: " + typeof document.all);
  console.log("toString: " + document.all);
  </code></pre>
  
  <p>It yielded:</p>
  
  <pre class="lang-none prettyprint-override"><code>typeof: undefined
  toString: [object HTMLAllCollection]
  </code></pre>
  
  <p>So why is <code>document.all</code> like this? Since <code>document.all</code> is an object (defined in my browser), shouldn't <code>typeof</code> return <code>"object"</code>, not <code>"undefined"</code>?</p>