FAQ: Intermediate JavaScript Modules - module.exports II

This community-built FAQ covers the “module.exports II” exercise from the lesson “Intermediate JavaScript Modules”.

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

Web Development

Introduction To JavaScript

FAQs on the exercise module.exports II

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!

The line 1 of 2-airplane.js is unnecessary. We export an anonymous object and in that line we are creating an empty object stored in the variable Airplane. The two objects have no relation. And we can store the module object in a variable named Airplane in the 2-missionControl.js file with require() and call the properties and methods in that variable Airplane.


This was the exact reason for me looking into the forum today lol. Thanks!

1 Like

Same! Thanks :slight_smile:

1 Like

Same here - it’s very confusing for a beginner.

Am I correct in saying that they should have put “Menu.” in front of each of the properties in the example? Then it would make sense and you export “Menu”. Or as stated here, don’t define an object and then subsequently export an anonymous object.

Absolutely right with my thinking

I was looking for the confirmation of my doughts about the first line too. Thanks.

Thank you for posting this. I was very also very confused about this being a beginner.

it would be great if someone from Codecademy could weigh in here. We all seem to agree in this thread that line 1 is unneccessary. Why is it there?

i want to use the errow function, in by runing it its not went through, pls fix it.

You want to use an arrow function where? Please post a link to the lesson you are referring to, so we can see what you are talking about.



Why do you ask us to use double quotes for part 1? That does not follow convention or the former course.


@jbevarts I agree; I was doing it and I tried to set the value of myAirplane to ‘CloudJet’ and it was wrong and then I changed it to “CloudJet” and it worked. o.O

I thought anonymous functions could be written func: (arr) => { …
Does the arrow change the scope?

I tried to wrap two separate variables in my code, say:

module.exports = {
  family: 'Pitter'
module.exports = function plus(a,b){console.log (a+b)};

and on the import side I always have access only to the last piece of code, I exported by this “module.exports = …” method. So just to make sure, as I understood this particular method lets us to export only one fragment of code right?