JavaScript snippets
Calculate dynamic text with a Code snippet that explicitly runs JavaScript. The calculated value is inserted in place of the code.
How to do it
- Create a Code snippet and enable Execute as JavaScript code in its settings.
- Start with a small expression. The final evaluated value becomes the output.
- Use Preview and confirm the result before inserting it in another app.
- When adding macro input, handle text and numbers deliberately. Unescaped text can change the meaning of JavaScript code.
Tips and limitations
- Ordinary Code snippets are not executed unless execution is enabled.
- Only run code you understand. Do not treat this feature as a full browser or Node.js environment.
- The examples below are calculations, not secure password generators or live currency services.
Example
Calculate a total
const quantity = 3;
const unitPrice = 12.5;
(quantity * unitPrice).toFixed(2);37.50
Build a numbered list
["Review draft", "Collect feedback", "Send update"]
.map((item, index) => `${index + 1}. ${item}`)
.join("\n");1. Review draft 2. Collect feedback 3. Send update