I am setting up a Google+ sign in, and I'm trying to set the email to a variable outside of the function that actually gets the email so that I can use it later for account creation. However I am having issues with scope in Javascript. When I run this code (note this is only part of the code), the first alert box that I get says "2: asdf" and the second alert box that I get says "1: [insert email here]". What I am expecting to get is to have the alert("2: " + email); have the email in it, instead of asdf, but it's not doing that. Any ideas?
    var email = "asdf";
    // Get the email
    gapi.client.load('oauth2', 'v2', function()
    {
        gapi.client.oauth2.userinfo.get().execute(function(resp) {
            email = resp.email;
            alert("1: " + email);
        });
    });
    alert("2: " + email);
 
    