The translator has fees and turnaround times. Now she needs quote lines for client emails and her bookkeeping sheet. The Python functions for_email() and for_sheet() each use a def with one return expression. You’ll port them as small, named JavaScript functions.
Name the Formatters
In Python, PEP 8 favors def over assigning a lambda to a name, and a lambda holds only one expression. A JavaScript arrow function, written with =>, is a full function with concise syntax. It can take any number of parameters and, with braces, hold a whole block of statements, so naming one in a const is everyday style. The parameters go before the arrow, and the expression after it supplies the return value:
const euroFormat = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "EUR",
});
const forEmail = (amount) => euroFormat.format(amount);
const forSheet = (amount) => amount.toFixed(2);
console.log(`Bauer Legal: ${forEmail(1116)}, 2 working days`);
console.log(`Nordwind GmbH: ${forSheet(1128)}, 6 working days`);
Run it to produce both quote lines: