Is there a way to automate the calling of all functions within a module instead of individually selecting each one?
For instance:
bettermovies.js
module.exports={
printAvatar: function(){
console.log("Avatar");
},
printLord: function(){
console.log("Lord of the Rings");
},
printGod: function(){
console.log("God Of War");
},
favMovie: "Return of the King"
}
betterindex.js:
var movies=require('./bettermovies');
movies.printAvatar();
movies.printLord();
console.log(movies.favMovie);
I am wondering if there's a more efficient method, especially when dealing with a large number of movie functions in .js. It could become quite cumbersome to call each function manually rather than having a single function to handle them. This also brings up another question - how would you exclude certain functions from being called if you had, let's say, 100 of these print"movie" functions and wanted to skip 3 particular ones?
Appreciate your insights!