title: ReferenceError: Can't find variable: i (for-loop problem)
body: <p>I made a break from my react native project for about 3 weeks and now I came back and wanted to work on it, unfortunaly the app doesnt even render the first screen components. I already figured out what the problem is, Im just totaly confused what is going on:</p>
  <pre><code>    var chatkeys = [];
      var partnerkeys = [];
      var contactsDATA = [];
  
      await firebase.database().
      ref(`users/${PersonalId}/chats`).
      once('value').
      then(snapshot =&gt;{
          for (i in snapshot.val()){//pulling all chatcodes out of database and pushing into chatkeys
              chatkeys.push(snapshot.val()[i]);
          };
      });
  </code></pre>
  <p>The problem is located in the for-loop. Here is the error Im receiving:</p>
  <blockquote>
  <p>[Unhandled promise rejection: ReferenceError: Can't find variable: i]</p>
  <ul>
  <li>node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13
  in tryCallOne</li>
  <li>node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0</li>
  <li>node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer</li>
  <li>node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass</li>
  <li>node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates</li>
  <li>node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6
  in __callImmediates</li>
  <li>node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6
  in __guard$argument_0</li>
  <li>node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10
  in __guard</li>
  <li>node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4
  in flushedQueue</li>
  </ul>
  <ul>
  <li>[native code]:null in flushedQueue</li>
  <li>[native code]:null in callFunctionReturnFlushedQueue</li>
  </ul>
  </blockquote>
  <p>How can JS not find the variable &quot;i&quot;? I never told JS to search for &quot;i&quot; - it's just supposed to be a counter to loop through the whole snapshot.val() array. What is going on here?</p>