2022-03-01 13:04:09 +01:00

50 lines
1.1 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-bin">Function bin <a href="#function-bin" title="Permalink">#</a></h1>
Format a number as binary.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.bin(value)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`value` | number | Value to be stringified
`wordSize` | number | Optional word size (see `format`)
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
string | The formatted value
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
//the following outputs "0b10"
math.bin(2)
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[oct](oct.html),
[hex](hex.html)