JavaScript/Notes/Debugging: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== It Doesn't Work! == | |||
* Make sure you've correctly added a closing </SCRIPT> tag. | |||
* Check the error console. | |||
* Validate the HTML Markup | |||
* See also [http://jsfaq.org/notes/code-guidelines/ Code Guidelines for Rich Internet Application Development] | |||
== How to Launch the Debugger == | |||
A few approaches: | A few approaches: | ||
=== debugger keyword === | === debugger keyword === | ||
Revision as of 17:25, 30 December 2013
It Doesn't Work!
- Make sure you've correctly added a closing </SCRIPT> tag.
- Check the error console.
- Validate the HTML Markup
- See also Code Guidelines for Rich Internet Application Development
How to Launch the Debugger
A few approaches:
debugger keyword
<source lang="javascript"> function myFunc(myParam) {
debugger;
var myVar = 1;
function innerFunc() {
}
} </source>
Error creating thumbnail: Unable to save thumbnail to destination
Add a Breakpoint
Error creating thumbnail: Unable to save thumbnail to destination
Debugger Keyword Full Example
Copy'n'paste this example into your text editor, open your browser, and open this file. <source lang="html5"> <!doctype html> <head> <title>Debugger Example</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body>
Test Debugger
When Entering an Execution Context, the Variable Environment is initialized with parameter variables, Function Declarations, and Variable Statements.
function myFunc(myParam) {
debugger;
var myVar = 1;
function innerFunc() {
}
}
<script> function myFunc(myParam) {
debugger;
var myVar = 1;
function innerFunc() {
}
} </script>
Open the debugger and then click the button below.
<button onclick="myFunc(7)">myFunc(7)</button> </body> </html> </source>