The Execute a JavaScript For Automation action executes a specified JavaScript, either from a file or text.
The results of the script can be:
JavaScript For Automation scripts are executed in the background via osascript. This means they are not allowed to do user interaction. You can work around this by asking an application like System Events to do the user interaction for you.
JavaScript For Automation scripts can access variables by using environment variables) or by talking to the Keyboard Maestro Engine
There is lots of good information on, and examples for, JavaScript For Automation on the forum, for example in the topic Learning & Using AppleScript & JavaScript for Automation (JXA)