split at number js code example
Example 1: split the numbers js
var num = 123456;
var digits = num.toString().split('').map(iNum => parseInt(iNum, 10));
console.log(digits);
Example 2: how to split two digit number in javascript
for (var i = 0, sum = 0; i < output.length; sum += output[i++]);
console.log(sum);
/*
* Outputs: 39
*/