I'm learning client-side javascript and i noticed in some tutorials let's say we are making a game, even with webpack bundler in place, they still do:
// game.js
function Game() {
// ... some code
}
module.exports = Game;
// index.js
const Game = require("./game.js");
window.Game = Game;
What's the point of adding such constructor function to window? we can always require them wherever we use it and use webpack to bundle them right?