refactor(curriculum): authors workshop step 7 description and tests update (#57081)

Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
This commit is contained in:
RGHANILOO
2024-11-08 08:05:05 +00:00
committed by GitHub
parent 50cf693d44
commit 614f830d55

View File

@@ -7,48 +7,63 @@ dashedName: step-7
# --description--
Now that you have the data you want, you can use it to populate the UI. But the fetched data contains an array of 26 authors, and if you add them all to the page at the same time, it could lead to poor performance.
Now that you have the data you want, you can use it to populate the UI.
Instead, you should add 8 authors at a time, and have a button to add 8 more until there's no more data to display.
But the data you are fetching will have a total of 26 authors. Instead of displaying all 26 authors at once, you should display 8 authors at a time.
Use `let` to create 2 variables named `startingIndex` and `endingIndex`, and assign them the number values `0` and `8`, respectively. Also, create an `authorDataArr` variable with `let` and set it to an empty array.
Start by using the `let` keyword to create two variables named `startingIndex` and `endingIndex`, and assign them the numbers `0` and `8`, respectively. You will need to use `let` here because you will be reassigning these values later on.
Then, create an `authorDataArr` variable and assign it an empty array.
# --hints--
You should use `let` to declare a variable named `startingIndex`.
```js
assert.match(code, /let\s+startingIndex/)
assert.match(code, /let\s+startingIndex/);
```
You should set your `startingIndex` variable to `0`.
Your `startingIndex` variable should be a number.
```js
assert.match(code, /let\s+startingIndex\s*=\s*0\s*;?/)
assert.isNumber(startingIndex);
```
Your `startingIndex` variable should be set to `0`.
```js
assert.strictEqual(startingIndex, 0);
```
You should use `let` to declare a variable named `endingIndex`.
```js
assert.match(code, /let\s+endingIndex/)
assert.match(code, /let\s+endingIndex/);
```
Your `endingIndex` variable should be a number.
```js
assert.isNumber(endingIndex);
```
You should set your `endingIndex` variable to `8`.
```js
assert.match(code, /let\s+endingIndex\s*=\s*8\s*;?/)
assert.strictEqual(endingIndex, 8)
```
You should use `let` to declare a variable named `authorDataArr`.
You should have a variable named `authorDataArr`.
```js
assert.match(code, /let\s+authorDataArr/)
assert.isDefined(authorDataArr);
```
You should set your `authorDataArr` variable to an empty array (`[]`).
Your `authorDataArr` variable should be an empty array.
```js
assert.match(code, /let\s+authorDataArr\s*=\s*\[\s*\]\s*;?/)
assert.isArray(authorDataArr);
assert.isEmpty(authorDataArr);
```
# --seed--