You can use the console.log(…args) method to debug your code. This method allows you to display the variables and debugging information in your browser console. The method takes primitives like String, Number, and Boolean (as well as objects without cyclical dependencies) as arguments.
Note that changing a script will affect all the users working with the form, as there’s currently no testing environment available. You can create a copy of the existing form template and do your testing there so that it doesn’t interfere with employee activities.