title: Caching in javascript
body: <p>Is there a limit on the ammount of data I can store inside a javascript variable? If yes:</p>
  
  <ol>
  <li><p>Is it limited by javascript, or by browser? (is it a fixed number, or a variable number?)</p></li>
  <li><p>What if the limit is reached, or exceeded? Does the browser crash, or javascript throws an error?</p></li>
  </ol>
  
  <p>If I am making a lot of ajax calls, to different pages, and I want to store the result of these ajax calls in a global variable in javascript for future use(to free up the amount of queries to the server, and quicken the response the user gets), is it guaranteed that my data will be stored in this variable?</p>
  
  <p>For example:</p>
  
  <pre><code> function afterAjaxResponse(responseText) {
       cache[ajaxIdentifier]=responseText;
   }
  </code></pre>
  
  <p>Is there a limit on how many data I can store in the "cache" object? If yes, can I check somehow if the data to be stored still fits in it, and if not, free up the cache? (for example with a try/catch)</p>
  
  <p>EDIT: The possible duplicate doesn't answer my question, because I want to know the limit of a javascript object, not a string, and it also doesn't answer to what happens when the limit is reached.</p>
  
  <p>There must be a limit, but it would be nice to know, if that limit comes from javascript or the browser, and if I can check somehow if that limit is reached, to solve the problem accordingly.</p>