To split a number in JavaScript, do this:
number.toString().split('').map(Number)
.Here's how you do it:
const number = 731;
const digits = number.toString().split('').map(Number);
console.log(digits); // [7, 3, 1]