javascript - call a java script function in a js file from a function of another js file -


my problem have 2 js file (1.js, 2.js), in both has same functionality , methods(or copy of file). want call function (like _finish() ) 1 js(1.js) file js file(2.js) file. can give solution.

i agree jandy. in case must use namespaces.
example, if have script 1 defining variable a , second script defining it's own variable a, when 2 scripts put together, last script executed browser overwrites a variable :

//script 1 var = 'script 1 value'; // ... //script2 var = 'script 2 value'; // ... alert(a); 

when execute above example, you'll see second script has redefined a variable. so, best way without having name conflicts using namespaces:

//script 1 script1namespace.a = 'script 1 value'; // ... //script2 script2namespace.a = 'script 2 value'; // ... alert(script1namespace.a); alert(script2namespace.a); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -