-
-
Notifications
You must be signed in to change notification settings - Fork 36k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape Sequences in Strings lesson has a bug. #12091
Comments
I don't know how familiar you are with the website this github account issue tracker was made for.
They are two word sentences, in sentences only the first word is capitalized: If you have any suggestions for resolving the issue outlined in my original post then please respond to the issue described. If you need further clarifications I would be more than happy to provide any details necessary to help resolve this issue. |
@BBLThumper thanks a lot for reporting! Let's keep focus and keep the discussion to the issue that you are facing,(we can discuss aesthetics in chat rooms, they are not related to FCC codebase, and hence not the issue tracker):
While I can't seem to classify this as a bug yet, I agree with you that different browsers will behave differently with same escape characters, that's because how each individual browser implement themselves.
Let's discuss and keep this open for more comments and if we need to modify the challenge. |
I can believe \r behaves a bit strange in different ways of outputing. Maybe it'll behave different in UNIX or older macs. Maybe \n behaves strange in windows, cause windows should be \r\n. |
I agree. Anyone up for any suggestions on rewording or adding some better explanation, that does not complicate the challenge? |
This looks like a duplicate of #10485 |
They are saying to use newline character, why are you using carriage character? Everything is correct except the case sensitivity part. "FirstLine\n\t\SecondLine\nThirdLine". For this, I got accepted. |
Hi medhatrinky, Since the start of this discussion, the lesson has changed. The Original lesson is included in the first post. The carriage return character has been removed from the newest version of the lesson. |
Issue Description
I think the "Escape Sequences in Strings" lesson has a bug.
I am going through the Javascript course on FreeCodeCamp.com and am stuck at this challenge, 'Escape Sequences in Strings':
Here is how I'm writing the code example:
js var myStr = "Firstline\n\\Secondline\\\rThirdline";
In the lesson, the check requires there to be only one
\n
. The\r
doesn't seem to function properly. I have tried different work arounds and searching hasn't provided any direction. I have tried using 'console' in the developer window of the browser and it appears\n
is working but the\r
is not.According to the rules of the instruction,
js var myStr = "Fristline\n\\Secondline\\\r\nThirdline";
is not valid by the lesson standards.
Is the carriage-return not working?
Am I misunderstanding the lesson?
According to the book 'Javascript Bible' by Danny Goodman, chapter 15 'The String Objects', section 'Special Inline Characters' states:
"In most cases, browsers ignore carriage returns or render them like spaces."
https://books.google.com/books?id=WMr2NEG88icC&pg=PT262&lpg=PT262&dq=javascript+carriage+return&source=bl&ots=dWFLqN0rlO&sig=eZGo_74AHZq_4e2pxmtiqXz6l9s&hl=en&sa=X&ved=0ahUKEwivlMaEqu_QAhWBOSYKHSviBM44HhDoAQgjMAI#v=onepage&q=javascript%20carriage%20return&f=false
To highlight this issue I put similar isolating code found in the lesson inside
console.log();
in the Developer window of the browser. I received some interesting results.This is what occurs in the browser as displayed in console:
js console.log("escape characters use a \\\nbackslash. But a carrige-return \rdoes this!");
escape characters use a \
backslash. But a carrige-return does this!
This is the same code copied to clipboard from the browsers console display and pasted into an editor:
js console.log("escape characters use a \\\nbackslash. But a carrige-return \rdoes this!");
escape characters use a \
backslash. But a carrige-return
does this!
Browser display:
js var myStr = "Firstline\n\\Secondline\\\rThirdline"; console.log(myStr);
Firstline
\Secondline\Thirdline
Clipboard paste result:
js var myStr = "Firstline\n\\Secondline\\\rThirdline"; console.log(myStr);
Firstline
\Secondline\
Thirdline
Browser Information
Firefox Version 49.0.2
Build ID 20161019084923
Update Channel release
User Agent Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0
OS Windows_NT 6.2
The text was updated successfully, but these errors were encountered: