Skip to content
Functionutilsv0.10.0

percentage

Takes two numbers and returns the percentage of the first number in the second number with two decimal places.

percentage(
    num1: number,
    num2: number
): number
percentage(25, 200); // 12.5
percentage(1, 3); // 33.33