var a="1234123123123123123123123123";
var b="1";
function getNumber(a,b){
let result=[];
let reservea=a.split("").reverse();
let reserveb=b.split("").reverse();
let min=reservea.length<=reserveb.length?reservea:reserveb;
let max=reservea.length>reserveb.length?reservea:reserveb;
for(let i=0;i<max.length;i++){
if(i<min.length){
result.push(parseInt(min[i])+parseInt(max[i]))
}
else{
result.push(parseInt(max[i]))
}
}
result.forEach(function(item,index){
result[index]=item%10;
if((index+1)<result.length){
result[index+1]+=Math.floor(item/10);
}
})
return result.reverse().join("");
}
console.log(getNumber(a,b))
console