mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-28 21:00:56 +08:00
fix(curriculum): optional spaces inside parenthesis (#53872)
This commit is contained in:
parent
d876ac9ef3
commit
320b868800
@ -18,7 +18,7 @@ Now you should see the songs in alphabetical order.
|
||||
You should have `renderSongs(sortSongs())`.
|
||||
|
||||
```js
|
||||
assert.match(code, /renderSongs\(sortSongs\(\)\)/);
|
||||
assert.match(code, /renderSongs\(\s*sortSongs\(\s*\)\s*\)/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -18,7 +18,7 @@ You need to use the `proportionalSize` function here to make sure the player's `
|
||||
You should have an `if` statement that checks if the right key was pressed and the player's `x` position is less than `proportionalSize(400)`.
|
||||
|
||||
```js
|
||||
assert.match(animate.toString(), /keys\.rightKey\.(pressed|pressed\s*===\s*true)\s*&&\s*player\.position\.x\s*<\s*proportionalSize\(400\)/);
|
||||
assert.match(animate.toString(), /keys\.rightKey\.(pressed|pressed\s*===\s*true)\s*&&\s*player\.position\.x\s*<\s*proportionalSize\(\s*400\s*\)/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -22,7 +22,7 @@ assert.match(animate.toString(), /else\s+if/);
|
||||
You should check if the left key was pressed and if the player's `x` position is greater than `proportionalSize(100)`.
|
||||
|
||||
```js
|
||||
assert.match(animate.toString(), /keys\.leftKey\.pressed\s*&&\s*player\.position\.x\s*>\s*proportionalSize\(100\)/);
|
||||
assert.match(animate.toString(), /keys\.leftKey\.pressed\s*&&\s*player\.position\.x\s*>\s*proportionalSize\(\s*100\s*\)/);
|
||||
```
|
||||
|
||||
You should assign the number `-5` to the player's `x` velocity inside the `else if`.
|
||||
|
||||
@ -17,7 +17,7 @@ You should have a `height` property.
|
||||
|
||||
```js
|
||||
const splitter = code.split("if (this.position.x < this.width) {")
|
||||
assert.match(splitter[1], /this\.height\s*=\s*proportionalSize\(40\)\s*;?/);
|
||||
assert.match(splitter[1], /this\.height\s*=\s*proportionalSize\(\s*40\s*\)\s*;?/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -16,7 +16,7 @@ Add a new object that has an `x` property with a value of `500` and a `y` proper
|
||||
You should have an object with an `x` property with a value of `500` and a `y` property with a value of `proportionalSize(450)`. You are using the `proportionalSize()` function here to make sure the `y` value is proportional to the screen size.
|
||||
|
||||
```js
|
||||
assert.match(code, /{\s*x\s*:\s*500\s*,\s*y\s*:\s*proportionalSize\(450\)\s*}/);
|
||||
assert.match(code, /{\s*x\s*:\s*500\s*,\s*y\s*:\s*proportionalSize\(\s*450\s*\)\s*}/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -15,7 +15,7 @@ Below that, add another object with an `x` property with a value of `700` and a
|
||||
You should have an object with an `x` property with a value of `700` and a `y` property with a value of `proportionalSize(400)`.
|
||||
|
||||
```js
|
||||
assert.match(code, /{.*x\s*:\s*700.*y\s*:\s*proportionalSize\(400\).*}/);
|
||||
assert.match(code, /{.*x\s*:\s*700.*y\s*:\s*proportionalSize\(\s*400\s*\).*}/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -31,14 +31,14 @@ You should assign the `width` property to `proportionalSize(40)`.
|
||||
|
||||
```js
|
||||
const splitter = code.split("ctx.fillRect(this.position.x, this.position.y, this.width, this.height);")
|
||||
assert.match(splitter[2], /this\.width\s*=\s*proportionalSize\(40\)\s*;?/);
|
||||
assert.match(splitter[2], /this\.width\s*=\s*proportionalSize\(\s*40\s*\)\s*;?/);
|
||||
```
|
||||
|
||||
You should assign the `height` property to `proportionalSize(70)`.
|
||||
|
||||
```js
|
||||
const splitter = code.split("ctx.fillRect(this.position.x, this.position.y, this.width, this.height);")
|
||||
assert.match(splitter[2], /this\.height\s*=\s*proportionalSize\(70\)\s*;?/);
|
||||
assert.match(splitter[2], /this\.height\s*=\s*proportionalSize\(\s*70\s*\)\s*;?/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -24,7 +24,7 @@ Your callback function should have `checkpoint`, `index` and `checkpoints` param
|
||||
|
||||
```js
|
||||
const splitter = code.split("player.velocity.y = gravity;")
|
||||
assert.match(splitter[1], /checkpoints\.forEach\(\s*\(checkpoint,\s*index,\s*checkpoints\)\s*=>\s*\{/);
|
||||
assert.match(splitter[1], /checkpoints\.forEach\(\s*\(\s*checkpoint\s*,\s*index\s*,\s*checkpoints\s*\)\s*=>\s*\{/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -14,7 +14,7 @@ Finally, display the `form` modal with the values of the input fields by using `
|
||||
You should use `classList` to toggle the class `hidden` on `taskForm`.
|
||||
|
||||
```js
|
||||
assert.match(editTask.toString(), /taskForm\.classList\.toggle\(('|")hidden\1\)\s*;?/)
|
||||
assert.match(editTask.toString(), /taskForm\.classList\.toggle\(\s*('|")hidden\1\s*\)\s*;?/)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user