title: Using the value of an object as the name of another object
body: <p>First, I want to apologize for the ambiguous title :)
  Second, I'm a novice with jQuery.</p>
  
  <p>I have a drop down with two values ("taget1" and "target2"). On page load, I'm setting the localStorage with a URL for each target (target1=google.com and target2=gmail.com).</p>
  
  <p>When the drop down changes, I set a "lastSelection" var in localStorage (lastSelection=target2).</p>
  
  <p>Now, I also want to get the relevant URL from localStorage. So when I change to "target2" I want to get the saved URL from localStorage. Instead of using an "if", I thought I can use the val() of the drop down.</p>
  
  <p>This did not work:</p>
  
  <pre><code>var url = localStorage.getItem([lastSelection])
  </code></pre>
  
  <p>How can I use the value of lastSelection to get a result like <code>localStorage.getItem('target2')</code>?</p>