export default function add(a, b) {
  let i = a.length - 1
  let j = b.length -1

  let carry = 0 // 进位
  let ret = ''

  while (i >= 0 || j >= 0) {
    let x = 0 // a 位数上的值
    let y = 0 // b 位数上的值
    let sum

    if (i >= 0) {
      x = a[i] - '0' // 将 string 转换成 number
      i --
    }

    if (j >= 0) {
      y = b[j] - '0'
      j --
    }

    sum = x + y + carry
    if (sum >= 10) {
      carry = 1
      sum -= 10
    } else {
      carry = 0
    }

    ret = sum + ret // 字符串拼接
  }

  if (carry) {
    ret = carry + ret
  }

  return ret
}
@@ -1,8 +1,155 @@
+/*%0A * @Author: Ge.Yuanjun %0A * @Date: 2020-04-07 01:21:44 %0A * @Last Modified by: Ge.Yuanjun%0A * @Last Modified time: 2020-04-07 01:26:11%0A */%0A%0A// %E7%AE%80%E6%B4%81%E7%89%88%0A
 export d
@@ -692,8 +692,337 @@
 rn ret%0A%7D
+%0A%0A/**%0A * %E9%AA%9A%E6%93%8D%E4%BD%9C%E7%89%88%E6%9C%AC%0A * @param %7B*%7D a %0A * @param %7B*%7D b %0A */%0Aexport function largeNumSum (a, b) %7B%0A  let c = 0%0A  let res = ''%0A  a = a.split()%0A  b = b.split()%0A  %0A  while (a.length %7C%7C b.length %7C%7C c) %7B%0A    c += ~~a.pop() + ~~b.pop() // boolean %E5%9E%8B%E5%8F%98%E9%87%8Fc%E4%BC%9A%E5%AD%98%E5%9C%A8%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2%EF%BC%88true -%3E 1, false -%3E 0%EF%BC%89%0A    res += c %25 10%0A    c = c %3E 9 // c %E5%9C%A8%E6%AD%A4%E5%A4%84%E9%87%8D%E7%BD%AE%E6%9C%AA boolean %E5%9E%8B%E5%8F%98%E9%87%8F %0A  %7D%0A%7D

add 骚版本