title: ReferenceError: function is not defined in Firefox
body: <p>When I try to load this script in Firefox, it gives me this error: 
  Reference Error: onListFriends is not defined.</p>
  
  <p>The code works fine in Safari and Chrome. </p>
  
  <pre><code>listFriends(onListFriends);
  
  function onListFriends() {
      console.log("friends were listed.");
      setOnline();
  }
  </code></pre>
  
  <p>And here is the listFriends function defined later in the file:</p>
  
  <pre><code>function listFriends(callback) {
      FB.api(
          "me/friends",
  
      function (response) {
          console.log("Got FB.api response");
          var numOnline = 0;
          var numFriends = response.data.length;
          for (var i = 0; i &lt; numFriends; i++) {
              isOnline(i, response.data, gotOnline);
              var callbackInc = 0;
  
              function callbackIfYouCan(callback) {
                  callbackInc++;
                  if (callbackInc == numFriends) {
                      interiorCallback(callback);
                  }
              }
  
              function gotOnline(res, ind, data) {
                  console.log("Got response from isOnline: " + res);
                  var id = data[ind].id;
                  var checkbox = document.createElement('input');
                  checkbox.type = "checkbox";
                  checkbox.name = "friends";
                  checkbox.id = id;
                  checkbox.value = data[ind].name;
                  console.log("For user " + checkbox.value);
                  var label = document.createElement('label');
                  label.htmlFor = id;
                  label.appendChild(document.createTextNode(data[ind].name));
                  if (res == 1) {
                      document.getElementById("online").appendChild(checkbox);
                      document.getElementById("online").appendChild(label);
                      document.getElementById("online").appendChild(document.createElement('br'));
                      numOnline++;
                  } else {
                      document.getElementById("offline").appendChild(checkbox);
                      document.getElementById("offline").appendChild(label);
                      document.getElementById("offline").appendChild(document.createElement('br'));
                  }
                  callbackIfYouCan(callback);
              }
          }
  
          function interiorCallback(callback) {
              if (numOnline &gt; 0) {
                  var textField = document.createElement('input');
                  textField.setAttribute('type', 'text');
                  textField.id = "message";
                  textField.value = "I would like to hang out at this place in 15 minutes.";
  
                  var button = document.createElement('button');
                  button.setAttribute('type', 'button');
                  console.log("Created tagging button.");
                  button.onclick = function () {
                      console.log("Tagging button pressed.");
                      getIdsFromCheckboxes();
                  }
                  button.innerHTML = "Tag your friends.";
  
                  document.getElementById("online").appendChild(textField);
                  document.getElementById("online").appendChild(button);
              }
              callback();
          }
      });
  
  }
  </code></pre>
  
  <p>What is the difference between the way Firefox and Chrome loads this code? Any help would be appreciated.</p>