title: Return value not updated inside IIFE
body: <p>In file A, I am getting a promise inside a IIFE, and updating a variable. This variable is returned(exposed for other files).</p>
  
  <pre><code>var ServiceResponse = (function() {
  var cardPattern = null;
  getCardPattern().then(function(response) {
      console.info('Successfully fetched card pattern details.');
      cardPattern = response;
      App.init();
  },
  function(error) {
      console.error('Failed fetching card pattern details!');
  });
  return {
      cardPattern : cardPattern
  }
  })();
  </code></pre>
  
  <p>In file B, I am trying to consume this returned variable but i am getting null and not the updated value from the promise response.</p>
  
  <pre><code>var validateCreditCard = function(cardNumber, expiryMonth, expiryYear, cvv) {
  var creditCardPattern = ServiceResponse.cardPattern;
  </code></pre>
  
  <p>I am making sure that from file B invocation is done only after the promise is returned, but no luck. Why?</p>