So I have this facebook login javascript code and say I want to make changes to a global variable that goes inside this function, is that possible? so I want to make something like this:
var Name;
window.fbAsyncInit = function() {
      FB.init({
        appId      : '2295720594086082',
        cookie     : true,
        xfbml      : true,
        version    : 'v3.2'
      });
      // FB.AppEvents.logPageView();   
    FB.getLoginStatus(function(response) {
        statusChangeCallback(response);
        FB.api('/me?fields=name,email', function(response) {
          console.log(response);
          Name = response.name;
        })
    });
console.log(Name);
But I always get that Name is undefined, I know that this function is Asynchronous but I don't know how to use this....
 
    