title: Why won't the variable update?
body: <p>I'm very new to JavaScript. I have the code below that need to check for an image (in this case google logo). if it find the logo, it needs to update "status1" to true, otherwise false. For some reason (likely very obvious to someone that knows what they're doing) this doesn't update and just stays at "false".</p>
  
  <p>Any help with this will be greatly appreciated.</p>
  
  <p>Thanks</p>
  
  <pre><code>function checkImage (src, good, bad) {
      var img = new Image();
      img.onload = good; 
      img.onerror = bad;
      img. src = src;
  
  }
  
  
  checkImage( "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", function(){ window.status1 = true; }, function(){ window.status1 = false; } );
  checkImage( "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", function(){ window.status2 = true; }, function(){ window.status2 = false; } );
  
  
  var store = new Vuex.Store({
      state: {
          // initial state
          servers: [
          { name: 'test', status: window.status1, adr: 'http://google.com' }]},
  
  
  </code></pre>