Saturday, September 29, 2018

Global functions in javascript

I'm new to js and trying to understand global and private functions. I understand global and local variables. But if I have an html named test.html and a 2 js files named test1.js and test2.js. Now I include the test1.js and test2.js in test.html and call the functions written in test2.js inside test1.js and test.html.



The functions that I have written in test2.js are in this form



function abc(){...}

function pqr(){...} etc.


are these above functions global? If they are , how can I not make them global and still access them in test1.js and test.html?



As I have read global functions or global variables are bad right?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...