Answers for "how to split a number javascript"

3

split the numbers js

var num = 123456;
var digits = num.toString().split('').map(iNum => parseInt(iNum, 10));
console.log(digits);
Posted by: Guest on February-29-2020
-1

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
 */
Posted by: Guest on April-09-2020

Code answers related to "how to split a number javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language