Function subtract

  • Subtracts the second number from the first (can be in Bangla or English digits).

    Parameters

    • a: string | number

      First number (Bangla or English digits).

    • b: string | number

      Second number (Bangla or English digits).

    • en: boolean = false

      If true, returns the result in English digits. Default is false (returns Bangla digits).

    Returns string

    The difference between a and b.

    subtract("১০", "২"); // returns "৮"
    subtract(10, 2, true); // returns "8"
    subtract("২০", "৫", true); // returns "15"
    subtract("১০০", "৫০"); // returns "৫০"

    If the input is invalid or not a number.