Created
April 26, 2022 10:32
-
-
Save samuelastech/eef57e8b72ad98c2f0cabf0e971f6856 to your computer and use it in GitHub Desktop.
Converting a number into array
This file contains 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
/** | |
* Takes a number and create an array from it | |
* @param {Number} number | |
* @returns {Object} | |
*/ | |
function numberToArray(number){ | |
return Array.from(String(number), digit => { | |
return Number(digit) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment