Untitled
unknown
plain_text
2 years ago
289 B
7
Indexable
const calculatePercentage = (predecessorValue: number, recentValue: number): number => {
const MAX_PERCENT = 100;
if (!predecessorValue && !recentValue) return 0;
if (!recentValue) return MAX_PERCENT;
return ((recentValue - predecessorValue) / predecessorValue) * MAX_PERCENT;
};Editor is loading...
Leave a Comment