Ad
Code
Diff
  • const getIDS = n => [...n].reduce((r,n) => r+Number(n),0)
    // or const getIDS = n => n.split('').reduce((r,n) => r+Number(n),0)
    • const getIDS = n => [...`${n}`].reduce((r,n) => r+Number(n),0)
    • const getIDS = n => [...n].reduce((r,n) => r+Number(n),0)
    • // or const getIDS = n => n.split('').reduce((r,n) => r+Number(n),0)