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 :