title: Parse object dot notation to retrieve a value of an object
body: <p>I'm finding myself struggling with a little problem. 
  Let's say I've got an object:</p>
  
  <pre><code>var foo = {
      bar: {
          baz: true
      }
  };
  </code></pre>
  
  <p>Now I also have a String <code>'foo.bar.baz'</code>. I'd now like to retrieve the value from the object using the string. </p>
  
  <p>Please note: This is just an example, the solution needs to be dynamic.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I need the variable name also to be dynamic and parsed from the string. Also I can't be sure that my variable is a property of the window.</p>
  
  <p>I have already built a solution using <code>eval</code>, but this is pretty ugly I think:
  <a href="http://jsfiddle.net/vvzyX/" rel="nofollow">http://jsfiddle.net/vvzyX/</a></p>