Converts a number to an array of its digits.
$ npm install to-digits
var toDigits = require('to-digits');
toDigits(7654); // [7, 6, 5, 4]
Use this to extend the native Number.prototype:
Number.prototype.toDigits = toDigits.extend
console.log((456).toDigits()) // [4, 5, 6]