Binary Agents - can't seem to pass the test

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");

Your code works exactly right for both the tests as far as I can tell.

1 Like

It still doesn’t work on mine, I don’t know what it might be :man_shrugging:

I’m curious, why this is your starting value?

also, please provide the challenge link, and the tests result

2 Likes

Solved it! This was the challenge:

I thought I was supposed to insert the double quotation marks in the end, but when I removed them from the variable it just passed. Thank you!