I have a external js file called main.js which is added in the index page. In some cases that main.js can be included from the another sub page, so it is leading to the execution of main.js twice. my main.js structure main.js
(function() {
console.log("js execution started");
//content goes here
//
//
}());
how can i avoid the execution of the main.js twice?