← Practice
Fundamentals·easy 10 min 50 XP

Calculate Discount

Return the final price after applying a percentage discount.

Examples

  • calculateDiscount(100, 20) → 80
  • calculateDiscount(50, 0) → 50

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Calculate Discount · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.