Freecodecamp: "ES6: Use export to Reuse a Code Block" doesn't pass the test

Created on 5 Jul 2018  Â·  6Comments  Â·  Source: freeCodeCamp/freeCodeCamp

Describe your problem and - if possible - how to reproduce it

When attempting to export the variable, the challenge fails with error "foo is exported.
bar is exported."

Add a Link to the page with the problem

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

Tell us about your browser and operating system

  • Browser Name: Google Chrome
  • Browser Version: Latest
  • Operating System: Windows 7 SP1

If possible, add a screenshot here

issue

All 6 comments

You need to add export before the variable as you are exporting variables here and not functions( check example 1).

According to the challenge, you are right. Now, it accepted the solution. But in the example, it is said that "Either approach is perfectly acceptable." why is the second approach not working?

@StubRavi Both the methods work but you are supposed to do it using the first one as instructed.
@QuincyLarson @Bouncey @raisedadead I think it will be better if the challenge accepted both types ie. foo should be exported using first method and bar should be exported using second method. Or the challenge should be split up into two sub-challenges.
Also there should be a space after bar and ‘=‘ .

screenshot 2018-07-16 13 34 15

Adding space before the equals sign allowed my test to pass but I thought I should mention this.

The spacing issue was fixed. Please close the issue @StubRavi

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raisedadead picture raisedadead  Â·  3Comments

itsmikewest picture itsmikewest  Â·  3Comments

Tzahile picture Tzahile  Â·  3Comments

trashtalka3000 picture trashtalka3000  Â·  3Comments

QuincyLarson picture QuincyLarson  Â·  3Comments