param { string } num1 param { string } num2 return { string } function StringAdd ( num1 , num2 ) { if ( typeof num1 !== 'string' || typeof num2 !== 'string' || num1 . length < 1 || num2 . length < 1 ) { return '' ; } while ( num1 . length < num2 . length ) { num1 = '0' + num1 ; } while ( num2 . length < num1 . length ) { num2 = '0' + num2 ; } let len = num1 . length ; let result = [ ] ; let plus = 0 ; for ( let i = len - 1 ; i >= 0 ; i -- ) { let sum = parseInt ( num1 [ i ] ) + parseInt ( num2 [ i ] ) + plus ; if ( sum > 9 ) { sum = sum % 10 ; plus = 1 ; } else { plus = 0 ; } result . unshift ( sum ) ; } return result . join ( '' ) ; } export { StringAdd } ;