title: Convert a JavaScript string in dot notation into an object reference
body: <p>Given a JavaScript object,</p>
  <pre><code>var obj = { a: { b: '1', c: '2' } }
  </code></pre>
  <p>and a string</p>
  <pre><code>&quot;a.b&quot;
  </code></pre>
  <p>how can I convert the string to dot notation so I can go</p>
  <pre><code>var val = obj.a.b
  </code></pre>
  <p>If the string was just <code>'a'</code>, I could use <code>obj[a]</code>. But this is more complex. I imagine there is some straightforward method, but it escapes me at present.</p>