I'm trying to debug a scope issue in Javascript, and there is definitely something I'm not getting here. I would be happy if someone could help.
Among other variables that I declare in the global scope:
var mesh1_min, mesh1_max;
Then I use them inside init().
function init() {
    fetchStl('Octocat-v1.stl', function (stlBinary) {
      geometry1 = parseStlBinary(stlBinary);
      center(geometry1);
      mesh1BB = geometry1.computeBoundingBox();
      mesh1_min = geometry1.boundingBox.min;
      mesh1_max = geometry1.boundingBox.max;
    });
    alert(mesh1_min)
}
And for some reason I get undefined when mesh1_min gets out of scope. It must have something to do with it getting out of scope, but why is that, because I defined it as a global variable on the top.
Thanks.
 
    