0

I got piece of javascript code:

       ... var loaderC = new THREE.ObjectLoader();
        var tes =["first"];
        loaderC.load("computer.json", function (obj) {
            scene.add(obj);  // this is Phisisjs object and it transfer obj properly

            tes.push( 'second');  // inside function  tes got ["first" , "second"]
            console.log("inside anonymous" ); // wont send anything to console
        });
          console.log(tes); // here tes consist only element "first" 

Looks for me that inside this anonymous function global variables are only coped to another variables and after function is finished all copies are disposed. How I can transfer value of variables and object outside of this anonymous function?

sensor
  • 119
  • 1
  • 6

0 Answers0