Logs
When things are going wrong and you find no errors in the console, you can try using logs. We have used logs several times with console.log, but we have not yet used them for debugging purposes. Generally, logs have the program output information at certain places in the program. If things don’t seem to be working, a console.log can help you check when your code is even being executed. When you run your program, if the log message doesn’t show up in the console, you know that the rest of the code wasn’t executed. You can also use logs to output the value of a variable at a given point in the program’s execution. These log messages won’t actually fix your bugs, but they can help you find what is causing the bug.
Before I found out about Developer ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access