Calculates the percentage of a value relative to a total.
The part value.
The total or whole value.
The percentage (0–100) or 0 if total is 0.
percentage(20, 100); // 20percentage(30, 60); // 50 Copy
percentage(20, 100); // 20percentage(30, 60); // 50
Calculates the percentage of a value relative to a total.