Is the FCC code checker faulty?

Tell us what’s happening:
This is about the 3rd time I’ve encountered a problem like this, FCC gives me no problems when I console.log the output, but as soon as I submit it, I get errors, in this case " binaryAgent("01000001 01110010 01100101 01101110 00100111 01110100 00100000 01100010 01101111 01101110 01100110 01101001 01110010 01100101 01110011 00100000 01100110 01110101 01101110 00100001 00111111") should return “Aren’t bonfires fun!?”"
It does in fact return “Aren’t bonfires fun!?” and it is of type string, so I don’t understand what the problem it. (Note: The other test also returns an error)

Your code so far


function binaryAgent(str) {
	let arr = str.split(" ");
	let newStr = '';
	for(let i in arr){
		newStr += parseInt(arr[i], 2).toString(10) + ' ';
	}
	arr = newStr.split(" ");
	str = '';
	for(let i in arr){
		str += String.fromCharCode(arr[i]);
	}
 console.log(str);
	return str;
}

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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.

Challenge: Binary Agents

Link to the challenge:

it returns "Aren't bonfires fun!?\u0000"

the issue is the last element of the array that comes from arr = newStr.split(" ");, the last element is an empty string

1 Like

Ohhhhh, I see! Thank you, this helped me fix my error! :smiley: