Skip to content
Advertisement

Attempting to return a number that represents the number of books that are currently checked out of the library

This is the prompt:

“The getBooksBorrowedCount() function in public/src/home.js has a single parameter:

  • An array of books.

It returns a number that represents the number of books that are currently checked out of the library. This number can be found by looking at the first transaction in the borrows key of each book. If the transaction says the book has not been returned (i.e. returned: false), the book has been borrowed.”

What I have tried:

JavaScript

Every time I run this code I receive an error stating that “expected null to equal 6” for the life of me i cannot figure this out, I need some help.

Example Data is listed here:

JavaScript

Advertisement

Answer

You have to access the first borrows array item to get your data

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement