You are in the global scope and overwriting a variable that already exists in the window object (the usual global context for browsers).
Solution 1: Use javascript modules, they execute in their own scope.
Solution 2: Use a self-executing function, then have all variables inside that scope.
Solution 3: Use a unique namespace to put your variables into. Like for example `const MyApp = {}; MyApp.name = "Bob";