From f9b8efdaeb35f9a8403c5b2727cc985f9c173011 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 24 Feb 2025 06:15:55 -0500 Subject: [PATCH] chore(curriculum): remove bad info from book organizer lab (#58946) Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com> --- .../67172b43f84bcd2dec238a3d.md | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lab-book-organizer/67172b43f84bcd2dec238a3d.md b/curriculum/challenges/english/25-front-end-development/lab-book-organizer/67172b43f84bcd2dec238a3d.md index 419f388391e..c6f22881044 100644 --- a/curriculum/challenges/english/25-front-end-development/lab-book-organizer/67172b43f84bcd2dec238a3d.md +++ b/curriculum/challenges/english/25-front-end-development/lab-book-organizer/67172b43f84bcd2dec238a3d.md @@ -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})`); }); ```