前端缓存

169 阅读1分钟

先标记一下,下面有时间

blog.csdn.net/gongch0604/…

www.jianshu.com/p/256d0873c…

js原型链mp.weixin.qq.com/s/h1PP_7VUj…

大数相加

function add(a,b){
  let str1 = a.split("");
  let str2 = b.split("");
  let flag = 0 ;//要不要进位
  let res = '';
  while(str1.length || str2.length || flag){
    flag = flag + ~~str2.pop() + ~~str1.pop();//~~取反,防止[].pop==undefined
    res = flag%10 +res;
    flag = flag > 9
  }
  return res.replace(/^0+/, '');

}