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

Function tipCalculator

08_08/script.js:11–20  ·  view source on GitHub ↗
(sum, percentage)

Source from the content-addressed store, hash-verified

9 */
10
11const tipCalculator = (sum, percentage) => {
12 let tip = sum * (percentage / 100);
13 let total = sum + tip;
14 console.log(`
15 Sum before tip: ${sum}
16 Tip percentage: ${percentage}%
17 Tip: ${tip.toFixed(2)}
18 Total: ${total.toFixed(2)}
19 `);
20};
21
22tipCalculator(29.95, 18);

Callers 1

script.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected