Challenge 6 Megathread

Welcome to challenge #6!

Use this thread for any and all questions relating to challenge 6

2 Likes

The link of arrays in the “Hint” is not working.

I think the correct one is

Yup you got it, probably when the team copied and pasted the link they had an extra space which caused this, they should fix it pretty soon.

1 Like

Had a little trouble passing the third condition. The key word that helped me was Add and Update. Which in this challenge means adding to the already formed roster instead of overwriting. Good luck!

After struggling with the first 5, I think I may be finally getting my brain around how this works . Challenge 6 is relatively straight forward if you read the document referenced in the Hint.

3 Likes

This one is a little tricky, I think the instructions are a little unclear. My first attemps were matching the astonaut object to a roster (Which to me didn’t make much sense). After a couple of read throughs it came to me.

I am curious on how you wrote yours

This one was odd for me. Usually I do these by looking up just the bare minimum. I find I learn more from trying to figure it out from the least information I can.

This time I just did a very quick and shallow google of arrays as they’re new to me. But the very first thing I tried worked perfectly, which was both surprising and… disappointing? Like, I’ve understood what was required and how it works but… the lack of failures leading up to it feels unsatisfying?

1 Like

My usual method:

  1. If I have any ideas from reading the challenge, try them.

  2. Google any vocabulary I don’t know (in the context of Javascript)

  3. Check the “Hint” tab

  4. Check the thread for the challenge

After each step I iterate variations on idea(s) I get from the new info until ideas are exhausted or they work.

4 Likes

Create a new variable to add (hint: push) astronaut to the array
Then return the array.

2 Likes

Your comment is misleading since arrays do not have “append” in JavaScript.

No need to make a new variable. Just add the astronaut to the roster and return the roster.

3 Likes

Thank you, again I was trying to over complicate things be making a new array to to draw out the properties to try and pass back lol

For those who have zero experience in this area like me, these challenges are very good and you have to think a lot, but it’s worth it.

1 Like

Looking at the example in this link helped me to better understand how to do today’s coding challenge.

https://www.programiz.com/javascript/examples/append-object-array

2 Likes

You are right. I thought that was what I read in the instructions. It was add.

Another 2-line code. Took me less than 10 mins to finish this challenge. I guess I have learnt ALOT every day. Keep the momentum going!!

I used an Array function to convert. Much easier than line by line in a for loop! Then just concatenate.

1 Like

You shouldn’t need to convert or concatenate anything. You’re just adding the Astronaut object to the Roster array.

I was wondering why people kept writing push…bit more efficient than my solution