JavaScript/Notes/Debugging: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
A few approaches: | A few approaches: | ||
=== debugger keyword === | |||
<source lang="javascript"> | <source lang="javascript"> | ||
function myFunc(myParam) { | function myFunc(myParam) { | ||
Line 14: | Line 14: | ||
=== debugger from the menu === | |||
[[File:Debugger.png]] | [[File:Debugger.png]] | ||
=== Add a Breakpoint === | |||
[[File:Debugger-breakpoint.png]] | |||
=== Debugger Keyword Full Example === | |||
<source lang="html5"> | <source lang="html5"> | ||
<!doctype html> | <!doctype html> |
Revision as of 16:40, 30 December 2013
A few approaches:
debugger keyword
<source lang="javascript"> function myFunc(myParam) {
debugger; var myVar = 1; function innerFunc() { }
} </source>
Add a Breakpoint
Debugger Keyword Full Example
<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>