Is it possible to access the locale variable from the main script and convert it into a global variable? The current method I tried does not seem to be working. Any advice or guidance is appreciated.
//Converting a local variable to a global variable
(function (exampleCode) {
"use strict";
var wert = 0.5;
var name = 'wert';
Object.assign( exampleCode, {
getValue: function() {
return name;
}
} );
} )( window.exampleCode = window.exampleCode || {} );
/////////////////////////////////////////////////////////////////////
//How can we retrieve 'var wert = 0.5' from the Test Script in the main script?
var update = function() {
requestAnimationFrame(update);
//var value = wert; //0.5
console.log( exampleCode.getValue() );
mesh.morphTargetInfluences[ 40 ] = params.influence1 = value;
};
update();