函数 bin #

将数字格式化为二进制。

Syntax #

math.bin(value)

Parameters #

Parameter Type Description
value number | BigNumber 要转换为字符串的值
wordSize number | BigNumber 可选的字大小(参见 format

Returns #

Type Description
string 格式化后的值

Throws #

Type | Description —- | ———–

Examples #

//the following outputs "0b10"
math.bin(2)

另请参阅 #

oct, hex

Fork me on GitHub