SQLDev for VS Code comes with a JDK version 21. That version does not include a JS engine anymore. In the standalone version of SQLcl we can control the JDK and choose one that has a JS engine. That's not possible within VS Code. As a result, the script command cannot be used.
This example script
script
console.log(42);
/
throws an error

It would be great if a future version would support the script command.
Thanks!