You can also do it in the "mathematical" way without treating the number as a string:
var num = 278;_x000D_
var digits = [];_x000D_
while (num > 0) {_x000D_
digits.push(num % 10);_x000D_
num = parseInt(num / 10);_x000D_
}_x000D_
digits.reverse();_x000D_
console.log(digits);
_x000D_
One upside I can see is that you won't have to run parseInt()
on every digit, you're dealing with the actual digits as numeric values.