← Back to challenges

Find the Discount

JavaScriptHardmathnumbers

Instructions

Create a function that takes two arguments: the original price and the discount percentage as integers and returns the final price after the discount.

Alternative Text

Examples

dis(1500, 50) ➞ 750

dis(89, 20) ➞ 71.2

dis(100, 75) ➞ 25

Notes

Your answer should be rounded to two decimal places.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Basic Calculator