From f5740bbd8d7062fcd0ee4ae2aa258700b90531e7 Mon Sep 17 00:00:00 2001 From: Elise Date: Fri, 14 Oct 2016 16:05:30 -0400 Subject: [PATCH] Corrects Escape Sequences in String The return carriage didn't give a new line, so the string is re-written. The Spanish translation is also updated. From issue 'new line character is required before third line' #10485. --- .../basic-javascript.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/challenges/01-front-end-development-certification/basic-javascript.json b/challenges/01-front-end-development-certification/basic-javascript.json index 1bfb35e9dc..d663ef635a 100644 --- a/challenges/01-front-end-development-certification/basic-javascript.json +++ b/challenges/01-front-end-development-certification/basic-javascript.json @@ -1164,10 +1164,10 @@ "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", "Assign the following three lines of text into the single variable myStr using escape sequences.", - "
FirstLine
\\SecondLine\\
ThirdLine
", + "
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.", - "FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine" + "FirstLinenewlinetabbackslashSecondLinenewlineThirdLine" ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -1178,16 +1178,16 @@ "tail": [ "(function(){", "if (myStr !== undefined){", - "console.log('myStr: '+ myStr);}})();" + "console.log('myStr:\\n' + myStr);}})();" ], "solutions": [ - "var myStr = \"FirstLine\\n\\\\SecondLine\\\\\\rThirdLine\";" + "var myStr = \"FirstLine\\n\\t\\\\SecondLine\\nThirdLine\";" ], "tests": [ - "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(/\\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 \\\\');" + "assert(myStr === \"FirstLine\\n\\t\\\\SecondLine\\nThirdLine\", 'message: myStr should have encoded text with the proper escape sequences and no spacing.');", + "assert(myStr.match(/\\n/g).length == 2, 'message: myStr should have two newline characters \\n');", + "assert(myStr.match(/\\t/g).length == 1, 'message: myStr should have one tab character \\t');", + "assert(myStr.match(/\\\\/g).length == 1, 'message: myStr should have one correctly escaped backslash character \\\\');" ], "type": "waypoint", "challengeType": 1, @@ -1199,7 +1199,7 @@ "
CódigoSalida
\\'apostrofe
\\\"comilla
\\\\barra invertida
\\nnueva línea
\\rretorno de carro
\\ttabulación
\\bretroceso
\\fsalto de página
", "Nota que la barra invertida por si misma tiene que ser escapada con el fin de mostrarse como una barra invertida.", "

Instrucciones

", - "Codifica la siguiente secuencia, separada por espacios:
barra invertida tabulación tabulación retorno de carro nueva línea y asignala a myStr" + "Codifica la siguiente secuencia, separada por espacios:
FirstLinenueva líneatabulaciónbarra invertidaSecondLinenueva líneaThirdLine" ] } }