The previous two recipes have already demonstrated the syntax for logging messages to a console.
console.log('hello world');
In this recipe, get ready to use the console for stepping through an application while watching the variable stack.
Right-click the line number and type an expression, just like you would within the parentheses of an if
statement. In the code snippet for this recipe, on line 30, use obj_key == "key3
".
Once the page is reloaded, the loop iterating over the object will run. On each pass through line 30, the conditional breakpoint will be evaluated. If it evaluates to true, the script is paused until the play button, or one of the other step controls is pressed. The play/continue button is indicated in this image by a black arrow. The second black arrow is pointing to the Watch window where a smorgasbord of the current variable and stack information is at our mousetips.