From 328c1d0d2cd709845dfe94b06dd5ba825eac7bca Mon Sep 17 00:00:00 2001 From: Peter Weinberg Date: Thu, 26 Jan 2017 19:43:53 -0500 Subject: [PATCH] fix quoting strings challenge --- .../basic-javascript.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json b/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json index c2ad0bb5c9..5f3d7a5351 100755 --- a/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json +++ b/challenges/02-javascript-algorithms-and-data-structures/basic-javascript.json @@ -1111,12 +1111,12 @@ "title": "Quoting Strings with Single Quotes", "description": [ "String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in JavaScript.", - "\"This string has \\\"double quotes\\\" in it\"", + "
\"This string has \\\"double quotes\\\" in it\"
", "The value in using one or the other has to do with the need to escape quotes of the same type. Unless they are escaped, you cannot have more than one pair of whichever quote type begins a string.", "If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:", - "'This string has \"double quotes\" in it. And \"probably\" lots of them.'", + "
'This string has \"double quotes\" in it. And \"probably\" lots of them.'
", "
", - "Change the provided string from double to single quotes and remove the escaping." + "Change the provided string from double to single quotes and remove the escaping. Do not change anything else." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -1128,12 +1128,13 @@ "(function() { return \"myStr = \" + myStr; })();" ], "solutions": [ - "var myStr = 'Link';" + "/* head */ 'use strict'; /* solution */ var myStr = 'Link'; /* tail */ (function() { return \"myStr = \" + myStr; })();" ], "tests": [ "assert(!/\\\\/g.test(code) && myStr === 'Link', 'message: Remove all the backslashes (\\)');", - "assert(code.match(/\"/g).length === 4 && code.match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');" + "assert(code.match(/\"/g).length === 6 && code.match(/'/g).length === 4, 'message: You should have two single quotes ' and four double quotes "');" ], + "type": "waypoint", "challengeType": 1, "translations": {