Binary agent challenge

Tell us what’s happening:
Describe your issue in detail here.
so i did what the hint mentioned .split all strings by it’s character. iterated the elements through a loop , converting it to the decimal value and then used the String.fromCharCode command to convert it to a string. pushed it to an array and joined it into string. i checke the output using console.log and everything looked ok but when i return the string and try to execute my code it got stuck . didnt say where i failed its as if i ran into an infinite loop somewhere.

  **Your code so far**

function binaryAgent(str) {
let result=[];
let bit='';
var arr=str.split(" ");

for (let i = 0; i < arr.length; i++){
 bit =String.fromCharCode(parseInt(arr[i],2));
return result

binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111");
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Binary Agents

Link to the challenge:

nevermine sorry guys. i figured it out. i had to assign result to a different variable. i was returning the result before the join function.

this is not changing result, you are still returning an array

that’s why it fails

yeah thank you, i figured taht out.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.