dsernst / to-digits

Converts a number to an array of its digits

Home Page:https://www.npmjs.com/package/to-digits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

to-digits

NPM Version Build Status

Converts a number to an array of its digits.

Install

$ npm install to-digits
var toDigits = require('to-digits');

Usage

toDigits(number)

toDigits(7654); // [7, 6, 5, 4]

toDigits.extend

Use this to extend the native Number.prototype:

Number.prototype.toDigits = toDigits.extend

console.log((456).toDigits()) // [4, 5, 6]

About

Converts a number to an array of its digits

https://www.npmjs.com/package/to-digits


Languages

Language:JavaScript 100.0%