Understand the Differences Between import and require: challenge bug

Tell us what’s happening:

  1. The challenge description is incorrect; you reference “string_functions” and the hint says “string-functions”
  2. The challenge desdribes using “./” to reference the imported file in the same directory; the hint excludes that so would reference node_modules, not a local file
  3. Regardless, the hint code does not work, nor does my correct code.

Your code so far
import { capitalizeString } from “./string_functions”;
“use strict”;
capitalizeString(“hello!”);

Also does not work with 'string_functions" or with “./string-functions” or with “./string_functions”


import { capitalizeString } from "string-functions";
"use strict";
capitalizeString("hello!");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/understand-the-differences-between-import-and-require

You need to have matching quotation marks for this to be valid code… try it.

But yeah, agreed, the description and solution are at odds with each other.

That was nothing but a typo in creating my comment; I had proper quotes when I ran the code.

And, the given hint answer just does not work:

"use strict";
import { capitalizeString } from "string-functions";
capitalizeString("hello!");

And notice that it CANNOT work because it doesn’t use “./” to make it a local file rather than a node_modules file. And if I add the “./” it still does not work. There’s something else going on and needs to be fixed.