Pregunta de entrevista de 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.

Respuesta de la entrevista

Anónimo

21 de dic de 2015

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