I have an array of functions like this:
var myFuncs = {
firstFun: function(string) {
// do something},
secondFunc: function(string) {
// do something},
thirdFunc: function(string) {
// do something
}}
What I want is, for example, to put the first two functions, firstFun{} and secondFunc{}, into separate js file, firstsecondFun.js using jQuery function or other approaches talked in How do I include a JavaScript file in another JavaScript file?
var myFuncs = {
jQuery.getScript("firstsecondFun.js", function(){
alert("Script loaded and executed.");
// // Here you can use anything you defined in the loaded script
}),
thirdFunc: function(string) {
// do something
}};p
firstsecondFun.js will be like:
firstFun: function(string) {
// do something},
secondFunc: function(string) {
// do something}
either with or without var myFuncs = {} so in the end the var myFuncs = {} will just the same as all functions in it.
I tried myFuncs.push but it does not work.