my problem is that i have two js file (1.js, 2.js), in both has the same functionality , methods(or like a copy of file). now i want to call a function (like _finish() ) from one js(1.js) file to another js file(2.js) file. can anyone give a solution.
Share
I agree with jAndy. In your case you must use namespaces.
For example, if you have script one defining variable
aand then the second script defining it’s own variablea, when the 2 scripts are put together, the last script executed by the browser overwrites theavariable :When you execute the above example, you’ll see that the second script has redefined your
avariable. So, the best way to do this without having name conflicts is using namespaces: