Chalkboard - v3.0.1
    Preparing search index...

    Function toBinary

    • Converts a decimal number to binary representation (base 2).

      Parameters

      • num: number

        The decimal number

      • Optionalprefix: boolean = false

        Whether to include "0b" prefix (optional, defaults to false)

      Returns string

      const bin1 = Chalkboard.numb.toBinary(10); // Returns "1010"
      const bin2 = Chalkboard.numb.toBinary(10, true); // Returns "0b1010"