Question regarding combined import statements

I have a question regarding this chapter “combining import statements” in Javascript lesson:

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

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

Question B: 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 one f the exercise. Am I missing something??

Please advise

The example description says

We can use an import keyword to import both types of variables as such:

I assume that this means that the point of the different imports are to show the that you can import two different types of variables in import statements.

To your second question, this is because the previous exercise exported the variable names with aliases.

As you can see, chefsSpecial andisVeg are aliases which were exported instead of the variable names.

Thanks. So I could import the GluttenFree in statement 1 itself, correct?
import { specialty, isVegetarian, isLowSodium, GluttenFree } from ‘./menu’;

Yes, so it would seem.

1 Like