MCPcopy
hub / github.com/LinkedInLearning/javascript-essential-training-2832077 / formatter

Function formatter

08_08e/script.js:10–17  ·  view source on GitHub ↗
(locale = "en-US", currency = "USD", value)

Source from the content-addressed store, hash-verified

8 */
9
10const formatter = (locale = "en-US", currency = "USD", value) => {
11 let formattedValue = new Intl.NumberFormat(locale, {
12 style: "currency",
13 currency: currency,
14 }).format(value);
15
16 return formattedValue;
17};
18
19const tipCalculator = (sum, percentage, locale, currency) => {
20 let tip = sum * (percentage / 100);

Callers 1

tipCalculatorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected