title: Can console.dir have side effects on the variables on which it's called?
body: <p>I was playing around with some JavaScript code and found that when I took my "console.dir" statements out, the results were different. It appeared as if certain properties seemed to become visible after console.dir was called. For example, the below code will print out "undefined" for x1._rgbString, but will print out an actual value for x2._rgbString.</p>
  
  <pre><code>var x1 = MochiKit.Color.Color.fromHexString("#ad3f40");
  console.log(x1._rgbString);
  
  var x2 = MochiKit.Color.Color.fromHexString("#ad3f40");
  console.dir(x2);
  console.log(x2._rgbString);
  </code></pre>
  
  <p>Full test code here: <a href="http://patorjk.com/misc/console-dir-test.htm" rel="nofollow">http://patorjk.com/misc/console-dir-test.htm</a></p>
  
  <p>If I add in a console.dir(x1) before console.log(x1._rgbString), then console.log(x1._rgbString) will start printing out a value instead of printing out undefined.</p>
  
  <p>Why would calling console.dir on the object effect the value of fields on the object? Does console.dir have side effects or is there something I'm missing here?</p>
  
  <p>*I'm aware that underscores usually mean private, but I was logging this value and was surprised it started showing up as "undefined" when console.dir wasn't first called. </p>