function addString(a, b){ let ans=[]; let add=0; let i=a.length-1; let j=b.length-1; while(i>=0||j>=0||add>0){ let num1 = i>=0? a.charAt(i)-'0':0; let num2 = j>=0? b.charAt(i)-'0':0; let result = num1 + num2 + add; ans.push(result%10); add = Math.floor(result/10); i--; j--; } return ans.reverse().join(''); }