How do I extract a property based on the contents of a variable in Javascript?
<p>I'm trying to read out the values from a jStorage JSON object called data.shake (val1 .. val6 properties), but cant figure the right syntax out so that it runs correctly. for example the console log output doesnt show the value stored in it.</p>

<pre><code>var sports = {1:'val1',2:'val2',3:'val3',
              4:'val4',5:'val5',6:'val6'};

    for (sport in sports) {
        if ('data.shake.'+sports[sport] != 0) { 
             console.log(sports[sport]+':'+'data.shake.'+sports[sport])
             //output: val1:data.shake.val1 
        }
     }
</code></pre>
