My JavaScript is having issues… I’m not sure what is wrong, can you help me?

Have you tried using console.log(); to troubleshoot your issues? If you have to place that on every line of your code and check the logs either by going to the “Inspect” element in Chrome or Firefox or Safari or by opening your Command line or Powershell window and seeing what pops up. The most common issues can be fixed by logging each and every line.

Alternatively, if you are having issues with console.log, most browsers support debugger as a way to debug your code. So, for example:

const a = someFunction();
debugger
const b = otherFunction();

This will make it so if you open the console in your browser, it will fire the debugger function and you can step through the code line by line while seeing the variables, etc.

If you have done this and still can’t fix the issue, you should now know exactly which line of code is giving you the issue which will help all of us in the long run.