The JavaScript step in Voiceflow allows you to manipulate existing variables within your project but cannot directly trigger content changes on a loaded page or modify page variables that are not defined within the Voiceflow environment. Here are some key points regarding the use of JavaScript in Voiceflow:
Code Steps cannot create new variables. Variables intended for manipulation must exist prior to their use in a Code Step.
You can pass data to set variables with default values upon load through specific JavaScript structures, but these are limited to the variables already defined in your Voiceflow project.
The JavaScript step supports ES6 and can be used for various tasks such as JSON data manipulation, variable and entity data processing, and handling the last utterance variable.
Variables can be manipulated using simple assignment operations within the code step, and you can conditionally branch the flow by returning custom path names.
For setting or changing variable values outside of the JavaScript step, the Set Step is used within the Voiceflow environment.