title: Java Script/jQuery – Simple if-statement not working with pre-defined variable
body: <p>Sorry, I'm kind of new to this.</p>
  
  <p>Is there a specific reason, why the if-statement in this snippet is not working? If yes, could somebody point me in the right direction?</p>
  
  <pre><code>var app = (function(){
     selector = {
         app: ".js-app",
         app__home: ".js-app__home"
     }
  
     foo();
  
     foo = function () {
       console.log(selector.app__home);
       if ($(selector.app).hasClass(selector.app__home)) {
          console.log("is home page")
       }
     }       
  })();
  
  $(document).on("ready", function() {
     app();
  });
  </code></pre>
  
  <p>The first console.log()-output (the one outside the if-statement) works correctly though.
  Thanks!</p>