DEV Community

Discussion on: Separate a multi-digit integer into a single-digit array.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Short version of string one:

const num = 123
const int = [...''+num].map(i=>+i)
Enter fullscreen mode Exit fullscreen mode