Back
JavaScript Function Executor
JavaScript Function
// Example: Calculate total price with tax function calculateTotal(input) { const { items, taxRate } = input; const subtotal = items.reduce((sum, item) => sum + item.price * item.quantity, 0); const tax = subtotal * (taxRate / 100); return { subtotal, tax, total: subtotal + tax }; }
JSON Input
{ "items": [ { "name": "Widget A", "price": 10, "quantity": 2 }, { "name": "Widget B", "price": 15, "quantity": 1 } ], "taxRate": 8.5 }
Output
Output will appear here...
Console Output
Console output will appear here...
Execute
Clear
Reset Example