title: Javascript can't set variable value
body: <p>I'm trying to get this function to set sortedScores to a value... whenever i do console.log anywhere it seems to store the values right, but it can't actually set sortedScores properly...</p>
  
  <pre><code>function facebook(sortedfriends) {
  
          var myID;
          var access_token;
     FB.init({
          appId  : something,
              status : true,
              cookie : true,
              xfbml  : true,
     });
  
     FB.getLoginStatus(function(response, sortedfriends) {
             if(!response.session) {
                 FB.login(function(response) {
                         myId = response.session.uid;
                         access_token = response.session.access_token;
                         //does stuff
  
                         if (!response.session) {
                             console.log('User cancelled login or did not fully authorize.');
                         }
                     });
             }
             else if(response.session) {
                 myId = response.session.uid;
                 access_token = response.session.access_token;
             var D = new Array();
                 this.access_token = access_token;
                 FB.api('/me/feed?access_token=' + access_token + '&amp;limit=100', function(response, sortedfriends) {
                 for( i=0; i&lt;response.data.length; i++) {
                             var msg = response.data[i];
                             D.push(msg);
                 }
                         sortedfriends = somefunction(D, myID);
                         //i know somefunction works because if i do console.log(sortedfriends) it shows me the right values...
  
                 });
  
             }
     });
  }
  </code></pre>
  
  <p>when i try 
      var friends;
      facebook(friends);
  friends is just undefined... halp?</p>