No, the browser does not automatically declare a variable using the script filename. If console.log(Control);
works, it's because Control.js
explicitly defines Control
as a global variable (e.g., using var Control = ...
or a function). To avoid this, use let
, const
, or ES modules.