Create an Export Fallback with export default - ON ONE LINE?

Tell us what’s happening:
Hi, can someone explain why this code is working only if is on one line? Im doing solutions in external editor and code is placed on multiple lines as in example. but when I place code to FCC editor code doesn’t pass. So I am confused. Test PASS only when code is on one line.

Your code so far


"use strict";
export default function subtract(x,y) {return x - y;} // PASS

"use strict";
export default function subtract(x,y) {
return x - y;
} // DO NOT PASS

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default

Many times the tests want you to write the code only the way they want, even if other ways are much cleaning or efficient. You will find these kind of things many times through the curriculum, but don’t worry, your code is fine; you just need to give the tests what they want to see.

In the future, if you’re certain your code is alright, visit the forum and look for that challenge to check if there’s an issue around the tests in that challenge.

Sometimes even a space matters :slight_smile:

I aware of some possible “problems” with spacing (lint) but in this case it was so weird that I get confused. :slight_smile: So Im glad thats its not my code but their environment. Is’t like if teacher ask you for result of 2+2 and on your answer “Is 4” teachers says “Really?”. Thanks for clarifying these possible glitches.

1 Like