From 6ef6ec84e6adc589938b1919b8c900e4945d2d68 Mon Sep 17 00:00:00 2001 From: "Krzysztof G." <60067306+gikf@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:12:03 +0100 Subject: [PATCH] fix(curriculum): require space between variable name and const/let/var (#57739) --- .../increment-a-number-with-javascript.md | 2 +- .../660f1e3f047bf4e403268713.md | 2 +- .../660f4a1472f8e63d76162ce5.md | 6 +++--- .../660f4a83373de83ea101685f.md | 2 +- .../660f4ae5b3924c3fc3373973.md | 2 +- .../660f4b33e2a3364094ecb540.md | 8 ++++---- .../660f4b641290da41b2cf0dd9.md | 4 ++-- .../660f4c3b01c44743719c99e4.md | 4 ++-- .../6610c8cfe4cf4d278e35c156.md | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index c11ae000e52..f3a1f06f559 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,7 +39,7 @@ You should not use the assignment operator. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) + /let\s+myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f1e3f047bf4e403268713.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f1e3f047bf4e403268713.md index 3ca43b789c3..54d128e9a2f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f1e3f047bf4e403268713.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f1e3f047bf4e403268713.md @@ -22,7 +22,7 @@ assert.match(__helpers.removeJSComments(code), /result/); You should use `let` to declare your `result` variable. ```js -assert.match(__helpers.removeJSComments(code), /let\s*result/); +assert.match(__helpers.removeJSComments(code), /let\s+result/); ``` Your `result` variable should be an empty string. diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a1472f8e63d76162ce5.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a1472f8e63d76162ce5.md index f299158deed..0228433467d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a1472f8e63d76162ce5.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a1472f8e63d76162ce5.md @@ -22,20 +22,20 @@ assert.lengthOf(__helpers.removeJSComments(code).match(/for\s*\(/g), 2); Your `for` loop should initialise `i` with the value of `count`. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count/); ``` Your `for` loop should use `false` as the condition. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*false/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*false/); ``` Your `for` loop should use `false` as the iteration. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*false\s*;\s*false\s*\)/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*false\s*;\s*false\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a83373de83ea101685f.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a83373de83ea101685f.md index 1e3c44fc2d1..6b4056f560c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a83373de83ea101685f.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4a83373de83ea101685f.md @@ -16,7 +16,7 @@ Set your loop's condition to run when `i` is greater than `0`. Your `for` loop should run when `i` is greater than `0`. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*false\s*\)/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*false\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4ae5b3924c3fc3373973.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4ae5b3924c3fc3373973.md index 89ca64d9d1c..910c6691c02 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4ae5b3924c3fc3373973.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4ae5b3924c3fc3373973.md @@ -16,7 +16,7 @@ Like you did earlier with `i = i + 1`, update your iteration statement to give ` Your `for` loop should use `i = i - 1` as the iteration. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b33e2a3364094ecb540.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b33e2a3364094ecb540.md index a9d699b1310..20991062481 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b33e2a3364094ecb540.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b33e2a3364094ecb540.md @@ -16,25 +16,25 @@ Open up the console to see the upside-down pyramid. Your `for` loop should call `rows.push()`. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(/); ``` You should call `padRow()` in your `.push()` call. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(/); ``` You should pass `i` as the first argument to your `padRow()` call. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i/); ``` You should pass `count` as the second argument to your `padRow()` call. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\)/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\)/); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b641290da41b2cf0dd9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b641290da41b2cf0dd9.md index 46157c75707..9661c03941f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b641290da41b2cf0dd9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b641290da41b2cf0dd9.md @@ -16,13 +16,13 @@ Replace your iteration statement with the correct statement using the subtractio Your `for` loop should not use `i = i - 1`. ```js -assert.notMatch(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); +assert.notMatch(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)), /for\(leti=count;i>0;i=i-1\)\{rows\.push\(padRow\(i,count\)\);/); ``` Your `for` loop should use subtraction assignment to reduce `i` by `1`. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*-=\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*-=\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4c3b01c44743719c99e4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4c3b01c44743719c99e4.md index 609eb8a720d..bf1ec2fe754 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4c3b01c44743719c99e4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4c3b01c44743719c99e4.md @@ -16,13 +16,13 @@ Replace your subtraction assignment with the decrement operator. Your `for` loop should not use subtraction assignment. ```js -assert.notMatch(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*-=\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); +assert.notMatch(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)), /for\(leti=count;i>0;i-=1\)\{rows\.push\(padRow\(i,count\)\);/); ``` Your `for` loop should use the decrement operator. ```js -assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s*i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i--\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); +assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i--\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/6610c8cfe4cf4d278e35c156.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/6610c8cfe4cf4d278e35c156.md index f64b00b9a5d..8a06ab492ff 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/6610c8cfe4cf4d278e35c156.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/6610c8cfe4cf4d278e35c156.md @@ -14,7 +14,7 @@ As expected, your function now returns `undefined` again. Your `call` variable i You should not have a `call` declaration. ```js -assert.notMatch(__helpers.removeJSComments(code), /const\s*call/); +assert.notMatch(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)), /constcall/); ``` You should not log your `call` variable.