Percentage Changed

Published by Mubashir Hassan in

Create a function that takes an old price oldPrice, a new price newPrice, and returns what percent the price decreased or increased. Round the percentage to the nearest whole percent.

Examples

percentageChanged("$800", "$600") ➞ "25% decrease"

percentageChanged("$1000", "$840") ➞ "16% decrease"

percentageChanged("$100", "$950") ➞ "850% increase"

Notes

N/A

Watch a quick demo on how Edabit works.