This is particularly helpful when used in combination with breakpoints in your code, allowing you to pause and inspect the script interactively at any point.
Typing a variable name and pressing Enter displays the variable's current value.
The Logging functions take a message-object as a parameter. This message-object is logged to the trace log. A message-object can contain a string, one or more variables, or a combination.
The functions console.log, console.info, console.warn, console.debug, and console.error all log a message. The only difference between the functions is the color-coding of the log entry and the inclusion of marker icons for warnings and errors. In the WAT Simulator, you can filter these messages for warnings and/or errors.
console.log("A console.log message..."); console.warn("A console.warn message..."); console.error("A console.error message...");
Note: You can also instruct the system to automatically popup the trace dialog for any logged messages of a specific severity or higher by setting the $ui.popupLevel to the desired level. It is set to non by default.
// Messages of priority Debug or higher to cause the trace dialog to pop up. var ui = $wat.log('ui'); ui.popupLevel = $ui.traceLevels.Debug;
Console assertions use the signature: console.assert(expression, message-object)
If expression evaluates to false, logs the message to the Trace Log. This will be displayed at the console.error level.
console.assert(myInt==0,"Uh oh, myInt has a value of 0!!!");