ProdanTenev

Sum of Numbers

Feb 25th, 2022
1,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.20 KB | None | 0 0
  1. function sumOfNums(input) {
  2.     let n = input[0];
  3.     let sum = 0;
  4.     for (let i = 0; i < n.length; i++) {
  5.         sum += Number(n[i]);
  6.     }
  7.     console.log(`The sum of the digits is:${sum}`);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment