21 Day Coding Challenge

Challenge 21 - where did I go wrong?

#1

Good morning!

I guess, as the last day, I had to get stuck '–

That’s what I have, and I actually thought this would finish the probl easily

//day 21
function returnToEarth(){
storing = broadcast();
decoding = decodeMessage(storing);
chaging = parseInt(decoding);

navigation.x = chaging.slice(0, 1);
navigation.y = chaging.slice(1, 2);
navigation.z = chaging.slice(2, 3);

}

returnToEarth();

#2

Hi Nathalia,

If you have completed rest of the 20 challenges, this one is an easy one for you too. You have to call broadcast 3 times and pass in string each time (‘x’,‘y’,‘z’) and store that in a respective variables. Rest of the functions you have to call on each of those three variables. The final value you must assign back to the navigation object.

Read the problem statement again to get clarity and go through hints as well.

PM me if still facing problem , would love to help you out.

1 Like
#3

You need to call broadcast 3 different times with each axis as an argument

broadcast('x')
broadcast('y')
broadcast('z')

For each call store it in a variable and then continue with the decoding + hex conversion steps. You’re already doing this part. You just have to do it 3 times :slightly_smiling_face:

Hint: your parseInt needs to be passed a different base when parsing a hex

1 Like
#4

Hi Nathalia,
You’ve got really good answers, but I was stumbling a little bit with that one too, so I’ll clarify the way I see it…

For each x, y and z, there’s three steps to do. (You could do them into a single string).

1st step is to pass it to broadcast:

2nd step is to pass it to decodeMessage()

3rd step, you want to parse the final value with parseInt, considering they’re Hex values…

And finally (is that a fourth step?) you’ll want to assign the end results of those three steps, for each value, to the properties x, y and z of navigation.

Let us know how it ends up :slight_smile:

1 Like
#5

if you haven’t already, click the hint button next to solve. It goes through the steps necessary to solve this challenge. For dealing with hex values, take a look at the parseInt() documentation here.

#6

OMGGG

OMGGGGGG

I FINISHED IT !!!

THANK YOUUUUUUUUU ALL!

I was over-complicating by slicing the whole thing hahahaha

1 Like