function bitArrayAdd(num1, num2){
let len = num1.length > num2.length ? num1.length : num2.length;
let ret = new Array();
let carryBit = 0;
for (let i = 0; (i < len || carryBit !== 0); i++){
let addItem1 = num1[i] === undefined ? 0 : num1[i];
let addItem2 = num2[i] === undefined ? 0 : num2[i];
let addRet = addItem1 + addItem2 + carryBit;
if (addRet > 9){
carryBit = 1;
addRet = (addRet % 10);
}
else {
carryBit = 0;
}
ret[i] = addRet;
}
return ret;
}function numToArray(num){
let ret = new Array();
while (num !== 0){
let eachBit = num%10;
num = Math.floor(num/10);
ret.push(eachBit);
}
return ret;
}let num1 = 134892;
let num2 = 2381;
08-19