FAQ: Intermediate JavaScript Modules - Combining Import Statements

This community-built FAQ covers the “Combining Import Statements” 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 Combining Import Statements

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!

Besides exporting/importing objects/functions/… from other js files, can we reuse code by citing the code sources in <script src="..."> in the html file, like what we do to use a JavaScript library?

If both ways are feasible, I’m curious about which is recommended and why. :smiley:

1 Like

this chapter was complete garbage, I’m gonna mention that half of units didn’t worked. The biggest issue I have, you didn’t tell how to setup environment in which those import-exports would work, it has 0 value in real world projects ! Thanks for wasting 2,5 hr of my life, now back to MDN&udemy!

1 Like

I had a similar experience.

1 Like

Codecademy, these chapters read like:

“Write 1”

“Ok, now delete 1 and write 2”

“Ok, now delete 2 and write 1 again”

“Ok, now delete 1, and write 3”

“Ok, now delete 3, and write 1 again”

“Conclusion, you can write either 1, 2 or 3. Good Job!”

I am starting to doubt the usefulness of this endeavour…

1 Like

These activities are really poorly made.

1 Like

I have a question regarding this chpater

import { specialty, isVegetarian, isLowSodium } from ‘./menu’;
2.
import GlutenFree from ‘./menu’;

Question : why are we using a different statement to import 2, and not using it as 1

Question: Also I noticed in one of the earlier chapter it says you can import with alias name without actualy using “as” keyword but directly putting Alias name,. Now this even though it works on codeacademy exercise, I did not read it this way when I go to cheatsheet. Can someone explain, below is an excerpt from the chapter :
"To import named export aliases with the as keyword, we add the aliased variable in our import statement.

import { chefsSpecial, isVeg } from ‘./menu’;

BUT AS YOU CAN SEE THERE IS NO "AS " keyword above and they have put alias names

and this seemed to have worked in ione f the exercise. Am I missing something??

Please advise

Why is this wrong?

I spend more time trying to work out why my correct answers are rejected than actually learning.
I am grateful for a free trial of CodeAcemy due to COVID lockdown but right now I cannot see me shelling out for a paid sub once this free sub expires - which is a shame.

I learn much more at codewithmosh.com