I'm pretty confused by the JavaScript scoping. I have a call to FB.api (shown below) that I would like to return a response object:
(function() {
    var permissions;
    FB.api("/me/permissions", "get", {access_token: options.token}, function(r) {
        permissions = r;
    });
    console.log(permissions);
})();
Ideally, I'd like to assign FB.api to a variable, and use the anonymous function to return the r component, but it appears like that's not doable.
Why is permissions undefined? Is there a way to set permissions in the parent scope?
