param { string } a param { string } b return { string } function SumBinary ( a , b ) { let arrA = a . split ( '' ) ; let arrB = b . split ( '' ) ; const len = Math . max ( arrA . length , arrB . length ) + 1 ; while ( arrA . length < len ) { arrA . unshift ( '0' ) ; } while ( arrB . length < len ) { arrB . unshift ( '0' ) ; } let result = [ ] ; for ( let i = len - 1 ; i > 0 ; i -- ) { result [ i ] = result [ i ] ? result [ i ] + parseInt ( arrA [ i ] ) + parseInt ( arrB [ i ] ) : parseInt ( arrA [ i ] ) + parseInt ( arrB [ i ] ) ; if ( result [ i ] > 1 ) { result [ i - 1 ] = result [ i - 1 ] ? result [ i - 1 ] + 1 : 1 ; result [ i ] = result [ i ] % 2 ; } } if ( ! result [ 0 ] ) { result . shift ( ) ; } return result . join ( '' ) ; } export { SumBinary } ;