split the numbers js
var num = 123456;
var digits = num.toString().split('').map(iNum => parseInt(iNum, 10));
console.log(digits);
split the numbers js
var num = 123456;
var digits = num.toString().split('').map(iNum => parseInt(iNum, 10));
console.log(digits);
javascript how to split array into subarrays javascript
// Example array.
let randomArray = [3, 5, 1, 5, 7,];
// Create an empty array.
let arrayOfArrays = [];
function splitArray( array ) {
while (array.length > 0) {
let arrayElement = array.splice(0,1);
arrayOfArrays.push(arrayElement);
}
return arrayOfArrays;
}
// Call the function while passing in an array of your choice.
splitArray(randomArray)
// => [ [ 3 ], [ 5 ], [ 1 ], [ 5 ], [ 7 ] ]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us