FAQ: Code Challenges - Code Challenge


#1

This community-built FAQ covers the “Code Challenge” exercise from the lesson “Code Challenges”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Express

FAQs on the exercise Code Challenge

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

I’ve been working on the express.js code challenges and have questions that hopefully somebody can help with.
For challenge number 6, here is my code https://gist.github.com/49bd6c5578762f4bc9447f2b9ecac9b4
My question is from line 32 where the code is:
currencies[currencyName] = newCountries;
I understand that this is assigning the new array from req.query to currencies[currencyName]. My question is doesn’t this erase the countries key from the currencies object? In my first solution, I wrote the code below:
currencies[currencyName][countries] = newCountries;
And it didn’t pass the test. Any thoughts on what happens to the original countries key in the currencies object? Doesn’t it get erased?


#3

I got stuck on this too.
They sending query with countries key and array. I think it’s not right way.