Freecodecamp: var myStr =("I am a "double quoted" string inside "double quotes"").

Created on 28 Jan 2016  ·  27Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge Escaping Literal Quotes in Strings has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

var myStr="\"I am a \"double quoted\" string inside \"double quotes\"\"." ;




Most helpful comment

var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line

This is correct one . hope this helps .

All 27 comments

try this

var myStr = "I am a \"double quoted\" string inside \"double quotes\""; // Change this line

Yea, I understand the confusion. The test message seems to contradict what the instructions ask for.
Instructions: I am a "double quoted" string inside "double quotes"
Test: "I am a "double quoted" string inside "double quotes""

There needs to be consistency here.

@fewspider's got the right answer, by the way.

Haha, irony abounds. We just changed this test to remove the outside double quotes, because people were being confused and double-double quoting, IE:
myStr = "\"I am a \"double quoted\" string inside \"double quotes\"\"";

At this point I don't know what to do.

I think either we need to remove first and last quotes from the test message or add a note that those should be ignored here.

We already removed the quotes. We just did that as per the discussion here on issue https://github.com/FreeCodeCamp/FreeCodeCamp/issues/5825.

We can't have it both ways. Either we include the quotes and risk that someone thinks that they need to include the outer quotes, or we omit them and users are trying to assign bare strings.

I think that maybe some clarifying language is needed.

Maybe in addition to clarifying language, you can also give actual code examples, instead of just the string with escaped characters. (Bold stuffs are text I added.)

In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash () in front of the quote.

var sampleStr = "Alan said, \"Peter is learning JavaScript\".";

This signals JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So when you print this to the console you'll get:

Alan said, "Peter is learning Javascript"

Instruction

Use backslashes to assign a string to the myStr variable so that it will print:

I am a "double quoted" string inside "double quotes"

@erictleung That's brilliant. Great idea. Feel Free to write a PR for this one.

It should be dot there: var myStr = "I am a \"double quoted\" string inside \"double quotes\".";
That is a right code.

This is how your code should be look like: var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

@Hassenkhel thanks.
Look like was a bug.

This is still confusing. I did as it says in the instructions, but still not working.

var myStr = "I am a \"double quoted\" string inside \"double quotes\"."; // Change this line

This is correct one . hope this helps .

they are very sensitive with space between the line.hmm

Okay

Puttasak insee

เมื่อ 12 ก.พ. 2017 07:15 "jin feng" notifications@github.com เขียนว่า

they are very sensitive with space between the line.hmm


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/freeCodeCamp/freeCodeCamp/issues/6541#issuecomment-279185928,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWEMJid_sP3TFQGH_M2aY0SjiSkCVtq_ks5rbk8dgaJpZM4HOQRp
.

Don't forget the period at the end!!!

var myStr= "I am a \"double quoted\" string inside \"double quotes\".";

Try this

var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

I have attempted to try inputting every suggested solution, of which, several were exactly what I had typed in as the code for this challenge:
"I am a \"double quoted\" string inside \"double quotes\".";
I ran it earlier and it told me that I am missing the semicolon, there is an unknown identifier, and, now tonight, I ran the same code after looking over it again(I didn't change what I had already typed in the box earlier.) It now runs and returns:
I am a "double quoted" string inside "double quotes". At least there isn't a list of errors now when I hover over my answer, only, red X's by both of the requirements to complete the challenge, so it still isn't accepting this answer. Is this the right answer? Is there still a bug on this challenge?
This challenge has had me stuck for some time now. Has anyone been able to input a solution and complete this challenge yet?

What was the challenge name? I'll double check the solution. For this one.... "you have a 'singlequote' inside of the double";

From what I remember. It was confusing.

Sent from my iPhone

On May 20, 2017, at 5:39 AM, Anne-Morris Cole notifications@github.com wrote:

I have attempted to try inputting every suggested solution, of which, several were exactly what I had typed in as the code for this challenge:
"I am a "double quoted" string inside "double quotes".";
I ran it earlier and it told me that I am missing the semicolon, there is an unknown identifier, and, now tonight, I ran the same code after looking over it again(I didn't change what I had already typed in the box earlier.) It now runs and returns:
I am a "double quoted" string inside "double quotes". At least there isn't a list of errors now when I hover over my answer, only, red X's by both of the requirements to complete the challenge, so it still isn't accepting this answer. Is this the right answer? Is there still a bug on this challenge?
This challenge has had me stuck for some time now. Has anyone been able to input a solution and complete this challenge yet?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

var myStr; myStr = "I am a \"double quoted\" string inside \"double quotes\".";
Just backslash out the 4 inner quotes. For some reason this thread is not allowing backslashes.

I had this same issue (on the beta) with Google Chrome 60.0.3112.78 on Ubuntu 14.04 and the way that I fixed it was to simply just reload the page. I've encountered this with a previous challenge too.

Was this solved? I'm running into the same problem

@jbrandes Could you paste your code here?

Just avoid spacing especially on quoted area.

image

Instruction: 1 space for every unquoted string and no space inside the double quoted string.
In short there should be at least one space before or after double quoted string.

my one is saying You should use two double quotes (") and four escaped double quotes (\").
any help in this would appreciated

@ndamane Please use our forum for debugging the code of your projects. If the forum members determine there is nothing wrong with your code, you can request this issue to be reopened. GitHub issues are meant for reporting bugs and not troubleshooting the code in your projects.

Thank you for understanding.

Not a bug but the 'feature'.
Everyone, including myself, is overthinking the purpose of the test. Edit what is given ex. that first line (var myStr = ""; // Change this line) is the correct line to use. Writing the corrected line underneath and leaving the pretext 'as is' is the error! The programs sees the pretext as incomplete and ignores everything else.
That is my observation, what do you think?

Challenge Escaping Literal Quotes in Strings has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

var myStr="\"I am a \"double quoted\" string inside \"double quotes\"\"." ;

try this ----->
var myStr = "I am a \"double quoted\" string inside \"double quotes\".";

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kokushozero picture kokushozero  ·  3Comments

jurijuri picture jurijuri  ·  3Comments

raisedadead picture raisedadead  ·  3Comments

danielonodje picture danielonodje  ·  3Comments

robwelan picture robwelan  ·  3Comments