Basic Javascript Debug
If you is starting in the Javascript world or is just trying to be better with Javascript, you need to debug better and know good tools. Especially if you not have a developer background.
As a tip i really recommend:
Know better the Console API
Maybe you are very close with console.log()
, but consider to explore more the Console API.
You can take more control with console.debug
, console.info()
and console.error()
. And get a better visualization with console.table()
.
To learn more about this API, take a look at https://getfirebug.com/wiki/index.php/Console_API
Debug with brakepoints
After some time, you will see you cant manage a lot of console.log()
. Start using the Sources tab at Chrome Developers Tools or the Script tab at Firebug. Put breakpoints, go ahead, take a step back, change the value of a variable and more.
At Firebug: https://getfirebug.com/javascript
At Chrome: https://developer.chrome.com/devtools/docs/javascript-debugging
If you use other techniques share with us.
Written by Luiz Fernando de Souza Filho
Related protips
1 Response
You can use debugger statement to suspends code execution.