There are so many different ways you can debug your Javascript Application. Stop using alert or console.log and start the debugger provided by almost all the browsers. Not only browsers, it is possible to debug javascript from your favorite IDE itself. Vscode debugger really shines when configured correctly.
0:00 - Intro
0:11 - Chrome Devtools
1:28 - Inline 'debugger'
1:56 - console.log or alert
2:20 - Debug from IDE like visual studio code (vscode)