During scripting i noticed that my 1.js script is quite long and since its hard to follow, i want to do some calculations that i currently do on 1.js in 2.js
I used export/import from ' ' statement but couldnt manage to send the variable 'first' under prototype.beginEvent in 1.js to 2.js
I wonder if there is a way to send a non global variable to another file do some computations and call it back to the original file.
I hope i made myself clear. Thanks a lot
Code: Select all
// 1.js
1.js.prototype.beginEvent = function() {
var first = 10;
import {second} from './2.js'
}
Code: Select all
//2.js
var second = 5 + first;
export { second };
}