21 Day Coding Challenge

Message.replace is not a function challenge 20/21


Yesterday, I cleared challenge 20, but today, it is giving error that - message.replace is not a function

function decodeMessage(message){
message = message
.replace(/1/g, ‘i’)
.replace(/4/g, ‘a’)
.replace(/3/g, ‘e’)
.replace(/0/g, ‘o’)
.replace(/2/g, ‘u’);

return message;

function returnToEarth(){
var broadx = broadcast(‘x’);
var broady = broadcast(‘y’);
var broadz = broadcast(‘z’);

var parsedx = parseInt(broadx, 16);
var parsedy = parseInt(broady, 16);
var parsedz = parseInt(broadz, 16);

navigation.x = decodeMessage(parsedx);
navigation.y = decodeMessage(parsedy);
navigation.z = decodeMessage(parsedz);


1 Like

It might not be related, but you don’t seem to have a value for 5…

Also, you seem to be inverting two steps…

Broacast -> decodeMessage -> parseInt…

It doesn’t exactly justify your error message, though, but that could definitely get in your way…


Got it, you are the champ! @Seb :slight_smile::star_struck:

1 Like