FAQ: Intermediate JavaScript Modules - module.exports II


#1

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!


#2

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.


#3

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


#4

Same! Thanks :slight_smile:


#5

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.