Frage im Vorstellungsgespräch bei Meta

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.

Antwort im Vorstellungsgespräch

Anonym

21. Dez. 2015

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