Another approach is to use objects like namespaces, e.g. in Gun.js:
const Gun = {
show()
{
alert("Gun");
}
};
const Laser = {
show()
{
alert("Laser");
}
};
Now you can call Gun.show()
or Laser.show()
. If each file puts everything in to the same "namespace" (really just a named object), then you have a way to distinguish functions, variables etc. with the same name.