Use export to Reuse a Code Block - using second Export approach does not work

Tell us what’s happening:

Going by the second approach explained in the section:

    const capitalizeString = (string) => {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
    const foo = "bar";
    export { capitalizeString, foo }

Why does

export {foo, bar};

not work correctly?

Your code so far


"use strict";
const foo = "bar";
const bar = "foo";

export{foo, bar};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:64.0) Gecko/20100101 Firefox/64.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block

It does work, but the test is asking for you to export the variables using the first method and not the second.

1 Like

Ah My bad. I missed this in the instruction

Utilizing the first way I demonstrated

Thanks @Dereje1 !