ES6: Use * to import Everything from a File
See original GitHub issueDescribe your problem and - if possible - how to reproduce it
there is still a problem with this exercise. the challenge states:
The code below requires the contents of a file, “capitalize_strings”, found in the same directory as it, imported. Add the appropriate import * statement to the top of the file, using the object provided.
which is fine, but it doesn’t give complete information to complete the challenge, I had to look in
ES6: Use * to Import Everything from a File - import name ambiguity #16356 to see what is ACTUALLY expected.
the code section has one line only:
"use strict";
there is absolutely nothing in the body of the explanation or the challenge description telling us what is actually required in the code!
if you do what it asks by adding:
import * as myModule from "capitalize_strings";
it gives an error<?> when you run the code that is less than helpful:
uses import * as properly
nowhere in the description does it say to use the module or what is in the module
for example:
"use strict";
import * as myModule from "capitalize_strings";
myModule.capitalize("foo");
myModule.lowercase("Bar");
interestingly however, now that I’ve had a successful test it passes with only the import line added to the code. I tried to repeat the error in firefox, originally the test was done in chrome, but again it passes the test with only the import * as myModule from "capitalize_strings";
line
This test would not pass previously until the code above created a successful result.
- Browser Name: Chrome
- Browser Version: Version 67.0.3396.87 (Official Build) (64-bit)
- Operating System: Windows 10
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
Okay, for those facing problems with https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file/ Remember two important things: The syntax is:
In the above, the Double Quotes (
" "
) and the Line ending semi-colon (;
) is very important. Also, make sure that the file path is correct. It doesn’t matter what name your object is having.I am not sure why this is happening and it shouldn’t happen.
I think I can work on this and open a PR if someone guides me where I have to edit the checks.
Here is what needs to change
Remove
, using the object provided
Allow single quotes around filename Allow no end semicolonUpdates to this challenge should also occur for https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/understand-the-differences-between-import-and-require and https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/import-a-default-export