1const myNumber = 1245;
2function numberToArray(number) {
3 let array = number.toString().split("");//stringify the number, then make each digit an item in an array
4 return array.map(x => parseInt(x));//convert all the items back into numbers
5}
6//use the function
7var myArray = numberToArray(myNumber);