SOURCE

const str = '123456'
const arr = str.split('')
let sum = 0
arr.map((item) => {
  sum += parseInt(item)
})
console.log('sum is:', sum)
console 命令行工具 X clear

                    
>
console