title: (doc && doc.scrollTop || body && body.scrollTop || 0) return 'Window' object
body: <p>I just want to get the scrollTop of document and use the code from this <a href="https://stackoverflow.com/questions/3464876/javascript-get-window-x-y-position-for-scroll">answer</a>. But what I get is a 'Window' object. I have tested with IE 10, Chrome and Firefox.
  Here is my code:</p>
  
  <pre><code>    var doc = document.documentElement, body = document.body;
      var left = (doc &amp;&amp; doc.scrollLeft || body &amp;&amp; body.scrollLeft || 0);
      var top = (doc &amp;&amp; doc.scrollTop  || body &amp;&amp; body.scrollTop  || 0);
  
      scroll = {
          top: (doc &amp;&amp; doc.scrollTop  || body &amp;&amp; body.scrollTop  || 0),
          left: (doc &amp;&amp; doc.scrollLeft || body &amp;&amp; body.scrollLeft || 0)
      };
  
  
      console.log(scroll.top); // return 0
      console.log(top); // return object 'Window'
  </code></pre>
  
  <p>I think it's a simple question but I can't figure out why it will return an object.</p>