Created
January 20, 2021 19:21
-
-
Save bobdobbalina/b4c61133933e9db8a101ac18096fcbf6 to your computer and use it in GitHub Desktop.
Javascript: Convert a number into an array of digits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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