chore(curriculum): remove bad info from book organizer lab (#58946)

Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
This commit is contained in:
Anna
2025-02-24 06:15:55 -05:00
committed by GitHub
parent 3fa2aefb75
commit f9b8efdaeb
@@ -25,7 +25,7 @@ dashedName: build-a-book-organizer
7. You should filter out books written after a certain year such as 1950 from the `books` array and save the filtered array in a new array named `filteredBooks`.
8. You should sort the books in the `filteredBooks` array according to their `releaseYear` in ascending order and save the sorted array in a new array named `filteredBooksSorted`.
8. You should sort the books in the `filteredBooks` array according to their `releaseYear` in ascending order. You learned in a prior lecture video that the `sort()` method will sort the array in place. This means the `filteredBooks` array will be mutated.
# --hints--
@@ -89,22 +89,10 @@ assert.isBelow(filteredBooks.length, books.length)
assert.isNotEmpty(filteredBooks)
```
You should have an array `filteredBooksSorted` in your code.
```js
assert.isArray(filteredBooksSorted)
```
The `filteredBooksSorted` array should have the same length of `filteredBooks`.
```js
assert.lengthOf(filteredBooksSorted, filteredBooks.length)
```
You should call the `sort` higher order function by passing the `sortByYear` callback function on the `filteredBooks` array.
```js
assert.match(__helpers.removeJSComments(code), /(const|let)\s+filteredBooksSorted\s*=\s*filteredBooks\s*\.\s*sort\s*\(\s*sortByYear\s*\)/);
assert.match(__helpers.removeJSComments(code), /\s*filteredBooks\s*\.\s*sort\s*\(\s*sortByYear\s*\)/);
```
# --seed--
@@ -160,10 +148,10 @@ const books = [
let filteredBooks = books.filter((book) => book.releaseYear < 1950);
let filteredBooksSorted = filteredBooks.sort(sortByYear);
filteredBooks.sort(sortByYear);
console.log("Books Written Before 1950 (sorted according to release year)");
filteredBooksSorted.forEach((book) => {
filteredBooks.forEach((book) => {
console.log(`${book.title} by ${book.authorName} (${book.releaseYear})`);
});
```