title: Uncaught TypeError: Cannot read property 'get' of undefined error
body: <p>I am trying to use either the email or username of the User class to login.  However, when I query for the email and try to do </p>
  
  <pre><code>object.get("username") 
  </code></pre>
  
  <p>I get the error message above.  Strangely, when I test the helper function getUsername in the debugger it works fine</p>
  
  <pre><code>function getUsername(email) {
    var query = new Parse.Query(Parse.User);
    query.equalTo('email', email);
    query.first({
      success: function(object) {
        console.log(object.get("username"));
        return object.get("username");
      },
      error: function(user, error) {
        console.log("no email");
      }
    });
  }
  
  
  function signIn(usernameOrEmail, password) {
  
    //if not email sign in with username
    if (usernameOrEmail.indexOf("@") == -1) {
      Parse.User.logIn(usernameOrEmail, password, {
        success: function(user) {
          console.log("Logged in!");
        },
        error: function(user, error) {
          alert("Error: " + error.code + " " + error.message);
        }
      });
    }
    //query for username from email and signin
    else {
      var username = getUsername(usernameOrEmail);
      Parse.User.logIn(username, password, {
        success: function(user) {
          console.log("Logged in!");
        },
        error: function(user, error) {
          alert("Error: " + error.code + " " + error.message);
        }
      });
    }
  }
  </code></pre>