Hello guys decide to refactor my javascript and try to seperate my onpage script to external js file.
please correct me if I am wrong, am still new to javascript, but this is the current setup I have:- my external file :-
exJS = function(){
this.coolMethod = function(){
//do cool code here
}
}
onpage Script:-
<script type="text/javascript" src="ex_js.js"></script>
<script>
exJs = new exJS();
exJs.coolMethod();
</script>
So obviously I am doing something wrong, How can I call a method within an object from a different file ?
I also welcome better suggestions to carry this out
Thank you
update: It didn't work as I didn't place a comma between the functions I have defined within an object ... silly mistake !!