ThingWorx Model Definition in Composer > Modeling > JavaScript Debugger > Variables in the JavaScript Debugger
Variables in the JavaScript Debugger
* 
The JavaScript Debugger (beta) is currently available in preview mode only and is not a verified feature in ThingWorx Platform 10.0.x releases.
The JavaScript Debugger allows you to inspect the current state of variables and change their value if required. In the JavaScript Debugger, the Variables section displays the current values of variables at the point where the execution is paused.
The Variables section includes the following tabs:
Scope
Watch
Terminal
Scope Tab
The Scope tab shows the state of the stack frame that is being viewed or debugged and any known variables declared in that section of the code. It displays the variable name in blue text followed by a colon separator and the variable’s value.
Scope variables are updated when changes are made to the system, either by stepping through the code or making changes in the Terminal tab.
Watch Tab
The Watch tab allows you to declare variables that you want to monitor as you debug the code. You can define variables to watch in both edit and debug modes.
If you define variables to watch in edit mode, their values appear empty. The variables that you set to watch are saved for the current user. When you are stepping through the code or making changes in the Terminal tab, the variables to watch are updated..
The Watch tab consists of the following:
Toolbar that contains buttons which allow you to add variables to watch, refresh the status of your defined variables to watch, and clear all variables marked to be watched.
Variable names and their current values.
(Edit watch expression) and (remove expression) for each variable.
* 
If a variable is not recognized in the frame being debugged, the value displays <not available>.
To add a new variable to watch, perform the following steps:
1. Click and enter the variable name in the field.
2. Press Enter or click outside of the field.
The new variable is added to the list.
* 
If the text field is left blank, the variable will not be added to the list.
Terminal Tab
The Terminal tab works like a debug shell. It displays variables and allows you to set their values at runtime. You can only update primitive values, such as string, number, and Boolean values. You can run a JavaScript condition or expression and view the result in the Terminal tab. You can use the toolbar to clear all expressions. Unlike variables set to be watched, expressions are executed once and are not updated as you debug the service. Expressions are saved with your username.
Was this helpful?