From 9ac7e5e7c3f50a0cee8d40a3e1ce3b1bcff4bfb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giftea=20=E2=98=95?= Date: Fri, 16 May 2025 18:01:32 +0100 Subject: [PATCH] fix(curriculum): improve lab password generator last user story (#60360) Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> --- .../lab-password-generator/66f53dc2c5bd6a11d6c3282f.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lab-password-generator/66f53dc2c5bd6a11d6c3282f.md b/curriculum/challenges/english/25-front-end-development/lab-password-generator/66f53dc2c5bd6a11d6c3282f.md index ee8d626e1c0..bb06ba15f83 100644 --- a/curriculum/challenges/english/25-front-end-development/lab-password-generator/66f53dc2c5bd6a11d6c3282f.md +++ b/curriculum/challenges/english/25-front-end-development/lab-password-generator/66f53dc2c5bd6a11d6c3282f.md @@ -16,7 +16,7 @@ In this lab, you'll practice using functions by building a random password gener 1. You should create a function called `generatePassword` that takes a parameter, indicating the length of generated password. You can name the parameter whatever you like. 2. Your function should return a string which represents a randomly generated password. You should use the following string and different `Math` methods to help you return a new string with random characters in it: `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()`. 3. You should define a variable called `password` and assign it the result of calling the `generatePassword` function with a numeric argument that represents the desired password length. -4. You should have a `console.log` that logs the message `"Generated password:"` followed by the `password` variable. +4. You should have a `console.log` that logs a single string made by concatenating the message `Generated password:` and the `password` variable separated by a space. # --hints-- @@ -85,11 +85,12 @@ assert.equal(password3.length, generatePassword(length2).length); assert.match(__helpers.removeJSComments(code), /(let|const)\s+password\s*=\s*generatePassword\(\d+\)\;/); ``` -You should log the generated password to the console. +You should log a single string combining `Generated password:` and the `password` separated by a single space using `+` or a template literal. ```js -const condition1 = /console\.log\(\s*["']Generated\s+password:\s*["']\s*\+\s*password\s*\);?/gm.test(code); -const condition2 = /console\.log\(\s*`Generated\s+password:\s*\$\{password\}`\s*\);?/gm.test(code); +const cleanCode = __helpers.removeJSComments(code); +const condition1 = /console\.log\(\s*["']Generated\s+password:\s*["']\s*\+\s*password\s*\);?/gm.test(cleanCode); +const condition2 = /console\.log\(\s*`Generated\s+password:\s*\$\{password\}`\s*\);?/gm.test(cleanCode); assert.isTrue(condition1 || condition2); ```