binary(num, [numBits])

Converts a byte, char, int, or color to a String containing the equivalent binary notation. For example color(0, 102, 153, 255) will convert to the String "11111111000000000110011010011001". This function can help make your geeky debugging sessions much happier.

Type: function

Parameter(s):

  • num {Number}:

    value to convert

  • numBits {Number} Optional:

    number of digits to return

Returns:

  • {String}:

    A formatted string