How to split a number into an array of digits in JavaScript

1 Answer

0 votes
const number = 908347;

const arr = Array.from(String(number), Number);

console.log(arr); 


 
   
   
   
   
/*
run:
   
[9, 0, 8, 3, 4, 7]
   
*/

 



answered Jun 22, 2022 by avibootz
...