The output of my code is correct, but I can’t seem to pass the tests. Might it be due to any character that is not visible? I’ve been stuck on this for some time, but I can’t spot the error.
This is my proposed solution:
function binaryAgent(num) {
var numbers = num.split(" ");
var decimal = [];
for (let i = 0; i < numbers.length; i++){
decimal.push(parseInt(numbers[i], 2));
}
var translation = '"';
for (let j = 0; j < decimal.length; j++) {
translation += String.fromCharCode(decimal[j]);
}
translation += '"';
return translation;
};
binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");