Freecodecamp: ES6: Use export to Reuse a Code Block - fails looking for exports keyword instead of export

Created on 28 Dec 2017  路  16Comments  路  Source: freeCodeCamp/freeCodeCamp



Challenge Name

https://beta.freecodecamp.org/en/challenges/es6/use-export-to-reuse-a-code-block

Issue Description


When attempting to export the variable in two different methods, the challenge fails with "exports is not defined"

Browser Information

Browser Name, Version:
Operating System: FireFox 57.0 (64-bit) and Chrome Version 63.0.3239.84 (Official Build) (64-bit)
Mobile, Desktop, or Tablet: Laptop Windows 10 Professional 64-bit

Your Code

Method 1:

`"use strict()";
export const foo = "bar";
export const boo = "far";`

Method 2:

`"use strict()";
const foo = "bar";
const boo = "far";

export {foo, boo};`


Screenshot

Method 1:
image

Method 2:

image

Most helpful comment

[SOLVED] :clap: :wave: :+1:

Put a space between "bar" and "="

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

Problem

I think my code is correct but still, it gave me an error any suggestions?
issue
#

All 16 comments

Thanks for all of the QA work @mstellaluna! I'm closing this as a duplicate of #16235

It looks like this issue is still not fixed.. export {foo, boo}; shows in results // running test
foo is exported.
bar is exported.
// tests completed
but fails

Exactly.

If you export bar only it won't even show up as exported.

Neither option works. Nothing happens if you use the first option. The console can't even print the error, it's too long. The second option passes the test in the log window but both options are still gray X.

[SOLVED] :clap: :wave: :+1:

Put a space between "bar" and "="

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

Problem

I think my code is correct but still, it gave me an error any suggestions?
issue
#

why not "export {foo, bar}" working?

challange is broken i suppose

@mohitsinghdz @Naxiden In problem It is explicitly mentioned to use first method as opposed to second.

@badarshahzad's solution worked for me.
Please use Alt Shift F to format code.

This challenge along with others are broken. This is my solution and it doesn't even do anything when I run the test:
const export foo = "bar"
const export bar = "foo"

I am leaving them for now until they're fixed. Going to contact Quincy or whoever.

@kalzimonium switch const and export

@sedmo. You鈥檙e right. I got it twisted, but still didn鈥檛 work. Not even export { foo, bar } work. I鈥檝e tried different browsers and still the same.

i tried this, and pass the test.
"use strict";
export const foo = "bar";
//export { foo };
export const bar = "foo";

@aryafathur nope, still didn鈥檛 work.

@badarshahzad posted the solution. Add a space after the variable 'bar'.

Do not work:
export const foo = "bar";
export const bar= "foo";

Works:
export const foo = "bar";
export const bar = "foo";

The answer is:

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

Was this page helpful?
0 / 5 - 0 ratings