There are many things that you can do to debug javascript:
- The easiest thing is to insert alert into the code, where you may alert the values and types of variables, function arguments, and object properties.
- Use confirm to force to certain path to be taken.
- Use prompt if you want to be able to cut and paste the results.
- window.onerror or try..catch statement to let code run without halting on errors and report all errors after the code has been executed.
- Run the code through js_lint to detect potential coding errors.
- If you’re on windows, use the Microsoft Script Debugger. Use the debugger keyword inside the script to turn control of the execution of the script over to the debugger. Be sure to turn error reporting on in IE.
Be First To Comment
Related Post
Leave Your Comments Below