title: Parsing strings (language strings) within js html library
body: <p>I want to seperate the language vars from my html libary but i'm not sure what the best approach for this is. </p>
  
  <p>Currently I got something like this;</p>
  
  <pre><code>function putAlertA() {
      alert('This is alert a');
  }
  
  function putAlertB() {
      alert('This is alert b');
  }
  
  function setAlerts() {
      putAlertA();
      putAlertB();
  }
  </code></pre>
  
  <p>Now i want to separate the strings from the functions:</p>
  
  <p><strong>Solution A</strong></p>
  
  <pre><code>function putAlertA() {
      var strings = getLanguageVars();
      alert(strings[0]);
  }
  
  function putAlertB() {
      var strings = getLanguageVars();
      alert(strings[1]);
  }
  
  function setAlerts() {
      putAlertA();
      putAlertB();
  }
  
  function getLanguageVars() {
      var strings = new Array();
      strings[0] = "This is alert a";
      strings[1] = "This is alert b";
      return strings;
  }
  </code></pre>
  
  <p><strong>Solution B</strong></p>
  
  <pre><code>function putAlertA(strings) {
      alert(strings[0]);
  }
  
  function putAlertB(strings) {
      alert(strings[1]);
  }
  
  function setAlerts() {
      var strings = getLanguageVars();
      putAlertA(strings);
      putAlertB(strings);
  }
  
  function getLanguageVars() {
      var strings = new Array();
      strings[0] = "This is alert a";
      strings[1] = "This is alert b";
      return strings;
  }
  </code></pre>
  
  <p><strong>Solution C</strong></p>
  
  <pre><code>function putAlertA() {
      var strings = window.strings;
      alert(strings[0]);
  }
  
  function putAlertB() {
      var strings = window.strings;
      alert(strings[1]);
  }
  
  function setAlerts() {
      putAlertA();
      putAlertB();
  }
  
  window.strings = new Array();
  strings[0] = "This is alert a";
  strings[1] = "This is alert b";
  </code></pre>
  
  <p>I think <strong>Solution C</strong> would be the best since I reckon <strong>solution A &amp; B</strong> generates too much overhead in terms of memory consumption and it doesn't look quite logical since the language array is a global var. I'm however a bit hesitant in using <code>window.</code>. Not sure it's the right approach how to do this. Maybe there's a better way how to do this? I'm using jQuery</p>