JavaScript has evolved over many years.  Some of what you have learned is probably out of date in the latest versions.  Now that you are competent you should force yourself to write only safe and up-to-date code.  Actually, you can ask your Web browser to force you!

Simply place this line at the top of every external JavaScript file:

"use strict";

The JavaScript interpreter within the browser will now tell you if any of your code is not properly written.  A simple example is where you try to use a variable without declaring it (e.g. firstName = "Fred"; without first putting let firstName;).  Originally a browser would still run the code but under the latest version of JavaScript it should not (it's to do with variable scope errors).

You should probably add that line to a few of your more complex pages and test them again.  You should be able to find solutions with a quick search.  One of the better reference sources is the Mozilla Developers Network which has a JavaScript section.  You might find it a bit challenging at first but you will get used to it as you become a better developer.