Sum of Numbers
🧩 Syntax:
function sumOfNumbers(input) {
let digitAsText = "" + input[0];
let sum = 0;
for (let index = 0; index < digitAsText.length; index++) {
let n = Number(digitAsText.charAt(index));
sum += n;
}
console.log(`The sum of the digits is:${sum}`);
}
sumOfNumbers(["1234"])