codetrix - v1.5.0
    Preparing search index...

    Function percentage

    • Calculates the percentage of a value relative to a total.

      Parameters

      • value: number

        The part value.

      • total: number

        The total or whole value.

      Returns number

      The percentage (0–100) or 0 if total is 0.

      percentage(20, 100); // 20
      percentage(30, 60); // 50