Intermediate Algorithm Scripting: Binary Agents not passing

I wrote the following code for the “Intermediate Algorithm Scripting: Binary Agents” challenge. Result is ok, but it does not pass the test. Any idea why ?

function binaryAgent(str) {
var translation = “”;
for (let i in str.split(" “)) { translation = translation + (”&#" + parseInt(str.split(" ")[i], 2) + “;”) };
console.log(translation);
console.log(typeof translation);
return translation;
};

Attached : screenshot :

You are outputting HTML entities and not letters, have a look at the String method fromCharCode.

Steps:

  1. Splitment of binary values into spaces
  2. Mapping of every element
  3. Parsing of element to decimal
  4. Conversion of the decimal value to its ASCII using Sting.fromCharCode()
  5. Jointment of ASCII values

Spoiler Alert:

str.split(" “).map(el => String.fromCharCode(parseInt(el,2))).join(”")

Writing “Spoiler Alert” isn’t super useful. Use the spoiler tags.

[spoiler]This text will be blurred[/spoiler]

Works like this