title: How can I change this DEBUG code to correspond to the window object as well?
body: <p><strong>How can I change this DEBUG code to correspond to the window object as well?</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/603987/what-is-the-javascript-equivalent-of-var-dump-or-print-r-in-php/11315561#11315561">What is the JavaScript equivalent of var_dump or print_r in PHP?</a></p>
  
  <hr>
  
  <p><strong>OK</strong></p>
  
  <blockquote>
  <pre><code>var hoge = new Object();
  hoge.q = "stack";
  hoge.lang = "js";
  hoge.state = 1;
  
  dump(hoge, 'body');
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
  <pre><code>dump(hoge, this);
  </code></pre>
  </blockquote>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
  <pre><code>dump(hoge, 'window');
  </code></pre>
  </blockquote>