Meta Interview Question

write a function that gets 2 strings. every string represent a binary number. the function should return a string that contain the sum of the two numbers also in binary.

Interview Answer

Anonymous

Dec 21, 2015

function test(s1, s2){ return (parseInt(s1, 2)+parseInt(s2, 2)).toString(2); } console.log('answer', test('101', '001');