# Number Operators

When we need to work with numbers, these operators will help with your markdown.

### {{bytes}}

Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned.

Examples:

• `'foo' => 3 B`
• `13661855 => 13.66 MB`
• `825399 => 825.39 kB`
• `1396 => 1.4 kB`

Params

• `number` {Number|String}
• `returns` {String}

Params

• `num` {Number}
• `returns` {Number}

### {{phoneNumber}}

Convert a string or number to a formatted phone number.

Params

• `num` {Number|String}: The phone number to format, e.g. `8005551212`
• `returns` {Number}: Formatted phone number: `(800) 555-1212`

### {{toAbbr}}

Abbreviate numbers to the given number of `precision`. This is for general numbers, not size in bytes.

Params

• `number` {Number}
• `precision` {Number}
• `returns` {String}

### {{toExponential}}

Returns a string representing the given number in exponential notation.

Params

• `number` {Number}
• `fractionDigits` {Number}: Optional. An integer specifying the number of digits to use after the decimal point. Defaults to as many digits as necessary to specify the number.
• `returns` {Number}

Example

``{{toExponential number digits}};``

### {{toFixed}}

Formats the given number using fixed-point notation.

Params

• `number` {Number}
• `digits` {Number}: (Optional) The number of digits to appear after the decimal point; this may be a value between 0 and 20. If this argument is omitted, it is treated as 0.
• `returns` {String}: A string representing the given number using fixed-point notation.

Example

``````{{toFixed "1.1234" 2}}
//=> '1.12'``````

### {{toFloat}}

Params

• `number` {Number}
• `returns` {Number}

### {{toInt}}

Params

• `number` {Number}
• `returns` {Number}

### {{toPrecision}}

Returns a string representing the `Number` object to the specified precision.

Params

• `number` {Number}
• `precision` {Number}: (Optional) An integer specifying the number of significant digits. If precison is not between 1 and 100 (inclusive), it will be coerced to `0`.
• `returns` {String}: A string representing a Number object in fixed-point or exponential notation rounded to precision significant digits.

Example

``````{{toPrecision "1.1234" 2}}
//=> '1.1'``````