mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): tests passing with seed code in Spam filter (#55589)
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ assert.match(code, /const\s+result\s*=/);
|
||||
Your `result` variable should have the value of `document.getElementById('result')`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(result, document.getElementById('result'));
|
||||
assert.match(code, /const\s+result\s*=\s*document\.getElementById\(\s*('|")result\1\s*\)/);
|
||||
```
|
||||
|
||||
You should use `const` to declare a `checkMessageButton` variable.
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ Use `regex` as the parameter for the callback function, for clarity.
|
||||
Your `isSpam` function should implicitly return the result of `denyList.some()`.
|
||||
|
||||
```js
|
||||
assert.match(code, /const\s+isSpam\s*=\s*(\(\s*msg\s*\)|msg)\s*=>\s*/)
|
||||
assert.match(code, /const\s+isSpam\s*=\s*(\(\s*msg\s*\)|msg)\s*=>\s*denyList\.some\(\s*[\s\S]*\)/)
|
||||
```
|
||||
|
||||
Your `.some()` method should use arrow syntax for the callback.
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ Your character class should be `0-9`.
|
||||
assert.match(dollarRegex.source, /\[0-9\] dollars/);
|
||||
```
|
||||
|
||||
Your `dollarRegex` should match `1 dollars`.
|
||||
Your `dollarRegex` should still match `"1 dollars"`.
|
||||
|
||||
```js
|
||||
assert.match('1 dollars', dollarRegex);
|
||||
|
||||
+2
-2
@@ -25,13 +25,13 @@ Your `dollarRegex` should use the `+` quantifier on your `[0-9]` character class
|
||||
assert.match(dollarRegex.source, /\[0-9\]\+/);
|
||||
```
|
||||
|
||||
Your `dollarRegex` should match `100 dollars`.
|
||||
Your `dollarRegex` should still match `"100 dollars"`.
|
||||
|
||||
```js
|
||||
assert.match('100 dollars', dollarRegex);
|
||||
```
|
||||
|
||||
Your `dollarRegex` should match `3 dollars`.
|
||||
Your `dollarRegex` should still match `"3 dollars"`.
|
||||
|
||||
```js
|
||||
assert.match('3 dollars', dollarRegex);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ To do this, start by checking for spaces before and after your pattern. You can
|
||||
Your `freeRegex` should use the `\s` token.
|
||||
|
||||
```js
|
||||
assert.match(freeRegex.source, /\s/);
|
||||
assert.match(freeRegex.source, /\\s/);
|
||||
```
|
||||
|
||||
Your `freeRegex` should look for spaces at the beginning and end of your pattern.
|
||||
|
||||
Reference in New Issue
Block a user