title: Get ID by key in localStorage
body: <p>In JS localStorage I can use</p>
  
  <pre><code>localStorage.getItem(key);
  </code></pre>
  
  <p>to get the value of the entry corresponding to the key in the <code>key</code> variable.</p>
  
  <p>How can I get the entry's ID (instead of value) using the key?
  <br><br><br>
  Edit: sorry I must have confused people. What I mean by "key" is the numerical key - which is 0, 1, 2, 3 etc depending on how many items have been saved. Then I want to find out the ID it was stored as, eg foo in the below example, from the numerical key.</p>
  
  <p><code>localStorage.setItem('foo', 'bar');</code></p>