How to debug errors in Javascript as a newbie

Emmanuel Osuolale - Jun 9 '22 - - Dev Community

I spent hours debugging my javascript code yesterday and I wanted to share with you what to do so you do not spend the same amount of time for a very simple problem.

  1. Using your browser - When debugging for frontend app use the console tab on your browser inspect option, to get here you can right click on an open page in your browser, click on inspect and then look for console, then refresh the tab open and see what errors it drops.

  2. Look for the red line - Don't take the error exactly for what it says or the line it tells you the error is coming from, read the code and look for the line where the error is coming from. Sometimes error messages are misleading and would lead you to going to google and trying what might not be the solution to your error, Make sure you know the line of code the error is coming from.

I hope this guide can help when you are trying to find bugs in your Javascript code next time, Thank you for reading this.

. . . . . . .
Terabox Video Player