This community-built FAQ covers the “Export as” 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 Export as
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? 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!
In what situation(s) would I export a function as an alias?
I understand importing a function as an alias, because I might want to use someone else’s function but give it a different name. But the use case for exporting a function with an alias is not clear to me. If I am exporting it with an easier or more descriptive name, then shouldn’t I have just used that name to begin with? What’s the purpose of creating a function with one name and then exporting it under a different name?
5 Likes
The task is shown as failed if I use new line instead of a space
Why is this lesson so particular about its semicolons all of a sudden. I feel like the code compiles just fine without it, but if you don’t have them in it won’t let you advance. Are semicolons low-key essential?
2 Likes
How do you use the as
keyword for exports upon declaration?
I’m trying to use the export/import syntax in Visual Study code with Node.js but keep getting the error:
“SyntaxError: Cannot use import statement outside a module”
I’ve googled this error and the common answer is that is have to add something to the package.json file, but when i searched my computer it found dozens of package.json files.
Any suggestions on how to make this work ?
Thanks,
Alex
Good day,
Do you run the npm init on your project file?
That is probably the package.json file they are referring to.