mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-05 09:01:18 -04:00
fix(curriculum): prevent hardcoding in addition functions (#60196)
This commit is contained in:
@@ -27,6 +27,12 @@ Your `addTwoAndSeven` function should return the sum of `2` and `7`.
|
||||
assert.strictEqual(addTwoAndSeven(), 9);
|
||||
```
|
||||
|
||||
Your `addTwoAndSeven` function should return the sum using the `+` operator.
|
||||
|
||||
```js
|
||||
assert.match(code, /return\s*(2\s*\+\s*7|7\s*\+\s*2)\s*;?/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
@@ -27,6 +27,12 @@ Your `addThreeAndFour` function should return the sum of `3` and `4`.
|
||||
assert.equal(addThreeAndFour(), 7);
|
||||
```
|
||||
|
||||
Your `addThreeAndFour` function should return the sum using the `+` operator.
|
||||
|
||||
```js
|
||||
assert.match(code, /return\s*(3\s*\+\s*4|4\s*\+\s*3)\s*;?/);
|
||||
```
|
||||
|
||||
You should call the `addThreeAndFour` function inside a `console.log`.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user