we have two js fie , test-1.js , test-2.js.
If you want to use code from test-1.js in test-2.js you have to load test-1.js first. JavaScript executes sequentially for synchronous code. So you can not access code from another scope (e.g. a file) if that code has not already been executed.
test-1.js
test-2.js