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.
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!
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??
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 agree, this chapter had lots of false negatives: the exercise would fail if you, for example, missed a semi-colon: a ‘requirement’ that was never enforced in previous chapters, and that any JavaScript developer will agree is largely a matter of personal preference.
Another inconsistency was that one exercise allowed a callback function to be an arrow function whereas another failed if the callback function wasn’t declared with the ‘function’ syntax. Neither used the ‘this’ keyword and so the distinction is arbitrary: in fact, it is standard to declare callback functions using the arrow function syntax!
This module is in dire need of reviewing, I can imagine it would be very discouraging to have so many failed exercises when actually the code they’ve submitted does meet the criteria given.
I think you have a problem with the apostrophes you are using around the .js filename. I think you have to use the apostrophe from the US keyboard layout. I had the same problem in earlier exercises when I had my keyboard input set to International.
Yep, I agree this lesson was VERY frustrating regarding the syntax demanded to complete the exercices. On the final exercise (14/15) I had no other choice but to ask the solution of the exercise because the step 1 wouldn’t validate. As a result, it overwrote not only the code in this exercise but ALL the code I wrote myself in the past exercices of that lesson as well, and all the comments I had inserted to add valuable explanations (found on the forums) disappeared due to this. Thank you very much…
As a paying user I feel that this kind of mishap is not acceptable. Especially when I see that people have been complaining about this for 2 years and NOTHING has changed.
Lots of tedious, mindless busywork that does very little to exercise understanding of the concepts you’re supposed to be learning. This lesson needs to be completely revised in my opinion. I’ll take my medal for finishing it but I don’t think I gained much else.
The course has been great, up until modules. It needs to be scrapped or reworked. I really enjoy the content otherwise, not trying to be negative just providing feedback.