Pass a jQuery variable to a string
<p>I have a jQuery object called <code>window.offset</code>. </p>

<p>This object has another object called <code>search</code>. </p>

<p>It has two values, <code>top</code> &amp; <code>left</code>.</p>

<p>Eg: </p>

<pre><code>window.offset.search = {top:200, left:150}
</code></pre>

<p>I want to pass this 'search' object as a variable called 'id'. </p>

<p>How to pass this variable to the <code>window.offset</code> object and get the <code>top</code> &amp; <code>left</code> value.</p>

<p>I tried as this. But it doesn't work.</p>

<pre><code>var offset = 'window.offset.'+id

console.log(offset.left); //undefined
</code></pre>
