Skip to content

Instantly share code, notes, and snippets.

@bobdobbalina
Created January 20, 2021 19:21
Show Gist options
  • Save bobdobbalina/b4c61133933e9db8a101ac18096fcbf6 to your computer and use it in GitHub Desktop.
Save bobdobbalina/b4c61133933e9db8a101ac18096fcbf6 to your computer and use it in GitHub Desktop.
Javascript: Convert a number into an array of digits
const digitize = n => [...`${n}`].map(i => parseInt(i));
digitize(691710147); // [6,9,1,7,1,0,1,4,7]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment