Then check if it's zero (because if it is, we can just return "zero").
Next, let's make sure we've defined the building blocks that will make up the final string. They include:
unitslikeone,thirteen, etc.tensvalues liketwenty,thirty, etc.scaleslikethousand, andmillion
Now we account for the various scales. Most of the scaling levels come up every 3 digits. Using this code block, we can get every 3 digits as chunks.

xxxxxxxxxxstart = string.length;chunks = [];while (start > 0) { end = start; chunks.push(string.slice((start = Math.max(0, start - 3)), end));}OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment

