Converts a number from a specified base to decimal (base 10).

const dec1 = Chalkboard.numb.toDecimal("1010", 2); // Returns 10
const dec2 = Chalkboard.numb.toDecimal("1a", 16); // Returns 26
const dec3 = Chalkboard.numb.toDecimal("0x2a", 16); // Returns 42
  • Parameters

    • num: string

      The string representation of the number in the specified base

    • base: number

      The base (2-36) of the number

    Returns number