Clarify escape literal quotes instructions

- Change example quote to valid JavaScript
- Add example of what you will get if you print said example quote
- Place emphasis on "if" in the instructions so that it'll hopefully be clear
  you do not actually need to print it
pull/6622/head
Eric Leung 2016-01-31 01:39:47 -08:00
parent ddcd37237c
commit b4e35cb535
1 changed files with 4 additions and 3 deletions

View File

@ -760,10 +760,11 @@
"description": [
"When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: <code>\"</code> or <code>'</code> inside of your string?",
"In JavaScript, you can <dfn>escape</dfn> a quote from considering it as an end of string quote by placing a <dfn>backslash</dfn> (<code>\\</code>) in front of the quote.",
"<code>\"Alan said, \\\"Peter is learning JavaScript\\\".\"</code>",
"This signals JavaScript that the following quote is not the end of the string, but should instead appear inside the string.",
"<code>var sampleStr = \"Alan said, \\\"Peter is learning JavaScript\\\".\";</code>",
"This signals to JavaScript that the following quote is not the end of the string, but should instead appear inside the string. So if you were to print this to the console, you would get:",
"<code>Alan said, \"Peter is learning JavaScript\".</code>",
"<h4>Instruction</h4>",
"Use <dfn>backslashes</dfn> to assign the following to <code>myStr</code> variable:",
"Use <dfn>backslashes</dfn> to assign a string to the <code>myStr</code> variable so that <em>if</em> you were to print it to the console, you would see:",
"<code>I am a \"double quoted\" string inside \"double quotes\"</code>"
],
"releasedOn": "January 1, 2016",