When I run node file.js 1 23 45
, it's supposed to printout One TwoThree FourFive
but for some reason it's not printing out. I think the script runs fine because I get no issues running it but it just doesn't printout anything. Am I missing something or am I completely wrong?
const numbersMap = new Map([
[ "0", "Zero" ],
[ "1", "One"],
[ "2", "Two"],
[ "3", "Three"],
[ "4", "Four"],
[ "5", "Five"],
[ "6", "Six"],
[ "7", "Seven"],
[ "8", "Eight"],
[ "9", "Nine"]
]);
function toDigits (integers) {
const r = [];
for (const n of integers) {
const stringified = n.toString(10);
let name = "";
for (const digit of stringified)
name += numbersMap.get(digit);
r.push(name);
}
console.log(r.join());
}