MCPcopy Create free account
hub / github.com/LinkedInLearning/javascript-essential-training-2832077 / tipCalculator

Function tipCalculator

08_10/script.js:41–51  ·  view source on GitHub ↗
(sum, percentage, locale, currency)

Source from the content-addressed store, hash-verified

39
40// Create a finalTip object with all the data. Send it to the printHTML callback.
41const tipCalculator = (sum, percentage, locale, currency) => {
42 let tip = sum * (percentage / 100);
43 let total = sum + tip;
44
45 const finalTip = {
46 sum: formatter(locale, currency, sum),
47 percentage: percentage + "%",
48 tip: formatter(locale, currency, tip),
49 total: formatter(locale, currency, total),
50 };
51};
52
53tipCalculator(29.95, 18, "de-DE", "EUR");

Callers 1

script.jsFile · 0.70

Calls 1

formatterFunction · 0.70

Tested by

no test coverage detected