--- layout: default ---

Function bin #

Format a number as binary.

Syntax #

```js math.bin(value) ```

Parameters #

Parameter | Type | Description --------- | ---- | ----------- `value` | number | Value to be stringified `wordSize` | number | Optional word size (see `format`)

Returns #

Type | Description ---- | ----------- string | The formatted value

Examples #

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

See also #

[oct](oct.html), [hex](hex.html)