iOS/macOS Shortcuts: Run JavaScript actions without data: URLs, third-party apps or APIs

It's already possible to run JavaScript code natively in Shortcuts app through the data: URL method1, but this one is less complicated and easier to remember.

1. Inside a Text action, create an HTML document containing script code that writes its output to a visible element

2. Either convert the document with the Make Rich Text from HTML action or use the Set Name action and set the name to <name>.html

3. Convert the result from the previous step with the Make PDF 2 action (use default settings)

4. Instead of using the Get Text from Input action to extract the text, use the Combine Text [with newlines] action which also converts the input to plain text. This is because the length of the output could cause multiple PDF pages being produced, which end up becoming separate items in a list that you would have needed to combine either way.

Example here

1 "Using JavaScript in your shortcuts"—reddit.com
2 This is the action that executes all scripts in the document unlike Make Rich Text from HTML which only applies CSS rules.