Problem with export block

Problem with export block
0

#1

Tell us what’s happening:
This is my code given below. I don’t understand why it isn’t working.

Your code so far


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

export { foo, bar }

But this code worked :-

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

Is my browser incompatible with export blocks??? Please let me know if you can help me out :smiley:

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


#2

Despite the description saying that either is fine, the tests only work for your second example - it’s not the browser or anything like that, both of the versions you’ve written are correct. If you look at the last line in the description:

Below are two variables that I want to make available for other files to use. Utilizing the first way I demonstrated export , export the two variables.