From 79f6622403281d2e94df3c6ef365f6a8fd911bbb Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 2 Jan 2025 03:49:56 -0500 Subject: [PATCH] fix(curriculum): allow variables in lab trivia bot (#57782) Co-authored-by: Naomi --- .../66ed41f912d0bb1dc62da5dd.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lab-javascript-trivia-bot/66ed41f912d0bb1dc62da5dd.md b/curriculum/challenges/english/25-front-end-development/lab-javascript-trivia-bot/66ed41f912d0bb1dc62da5dd.md index 65e5ad43711..5ea8bb721bd 100644 --- a/curriculum/challenges/english/25-front-end-development/lab-javascript-trivia-bot/66ed41f912d0bb1dc62da5dd.md +++ b/curriculum/challenges/english/25-front-end-development/lab-javascript-trivia-bot/66ed41f912d0bb1dc62da5dd.md @@ -72,20 +72,18 @@ You should use `let` to declare a new variable `codingFact`. ```js const codeWithoutComments = __helpers.removeJSComments(code); -const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|').+?\2\s*\+\s*favoriteLanguage/g) assert.match(code, /let\s+codingFact/) -assert.include(first, 'let'); -assert.exists(first); ``` You should give `codingFact` a value that includes `favoriteLanguage` using concatenation. ```js const codeWithoutComments = __helpers.removeJSComments(code); -const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|').+?\2\s*\+\s*favoriteLanguage/g) -assert.match(code, /let\scodingFact\s*=\s*("|').+?\1\s*\+\s*favoriteLanguage/) +const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g) +assert.match(code, /let\scodingFact\s*=\s*("|')?.+?\1?\s*\+\s*favoriteLanguage/) assert.include(first, 'let'); assert.exists(first); +assert.isNotEmpty(codingFact); ``` You should log `codingFact` to the console. @@ -102,11 +100,12 @@ You should assign a new value to `codingFact` that also contains `favoriteLangua ```js const codeWithoutComments = __helpers.removeJSComments(code); const loggingCodingFacts = codeWithoutComments.match(/console\.log\(\s*codingFact\s*\)/g) -const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|').+?\2\s*\+\s*favoriteLanguage/g) +const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g) assert.include(output[4], favoriteLanguage); assert.notEqual(output[4], output[3]); assert.isAtLeast(loggingCodingFacts.length, 2); assert.exists(second); +assert.isNotEmpty(codingFact); ``` You should assign a value to `codingFact` for the third time that also contains `favoriteLanguage`, and log it to the console. @@ -114,12 +113,13 @@ You should assign a value to `codingFact` for the third time that also contains ```js const codeWithoutComments = __helpers.removeJSComments(code); const loggingCodingFacts = codeWithoutComments.match(/console\.log\(\s*codingFact\s*\)/g) -const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|').+?\2\s*\+\s*favoriteLanguage/g) +const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g) assert.include(output[5], favoriteLanguage); assert.notEqual(output[5], output[4]); assert.equal(output[5], codingFact); assert.lengthOf(loggingCodingFacts, 3); assert.exists(third); +assert.isNotEmpty(codingFact); ``` You should log to the console `"It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)."` using concatenation to add the values of the variables.