From 885b3b27335a13866cc1d3b7e7c4d507a5d4839a Mon Sep 17 00:00:00 2001 From: BKinahan Date: Wed, 29 Jun 2016 16:32:22 +0000 Subject: [PATCH] Simplify escape sequences and associated tests --- .../basic-javascript.json | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index 0541df41456..a2b344d86db 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -1036,14 +1036,14 @@ "title": "Escape Sequences in Strings", "description": [ "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", - "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", + "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnewline
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", - "Assign the following two lines of text into the single variable myStr using escape sequences.", - "
Here is a backslash: \\.
        Here is a new line with two tabs.
", - "You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above with no additional spaces between each escape sequence.", + "Assign the following three lines of text into the single variable myStr using escape sequences.", + "
FirstLine
\\SecondLine\\
ThirdLine
", + "You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words.", "Here is the text with the escape sequences written out.", - "Here is a backslash: backslash.newline tab tab Here is a new line with two tabs." + "FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine" ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -1058,14 +1058,13 @@ "else{return null;}})();" ], "solutions": [ - "var myStr = \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\";" + "var myStr = \"FirstLine\\n\\\\SecondLine\\\\\\rThirdLine\";" ], "tests": [ - "assert(myStr === \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\", 'message: myStr should have encoded text with the proper escape sequences and spacing.');", - "assert(myStr.match(/\\t/g).length == 2, 'message: myStr should have two tab characters \\t');", + "assert(myStr === \"FirstLine\\n\\\\SecondLine\\\\\\rThirdLine\", 'message: myStr should have encoded text with the proper escape sequences and no spacing.');", "assert(myStr.match(/\\n/g).length == 1, 'message: myStr should have one newline character \\n');", - "assert(myStr.match(/\\\\/g).length == 1, 'message: myStr should have a correctly escaped backslash character \\\\');", - "assert(myStr === \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\", 'message: myStr should not have any spaces in between consecutive escape sequences.');" + "assert(myStr.match(/\\r/g).length == 1, 'message: myStr should have one carriage return character \\r');", + "assert(myStr.match(/\\\\/g).length == 2, 'message: myStr should have two correctly escaped backslash characters \\\\');" ], "type": "waypoint", "challengeType": 1,