Build a Library Manager - Step 6

Hello together!

I am returning the number of the books of the author but somehow the test doesnt pass. Should the number simply be returned or like I did with literal syntax?

const library = [
  {
    title: 'Your Next Five Moves: Master the Art of Business Strategy',
    author: 'Patrick Bet-David and Greg Dinkin',
    about: 'A book on how to plan ahead',
    pages: 320,
  },
  {
    title: 'Atomic Habits',
    author: 'James Clear',
    about: 'A practical book about discarding bad habits and building good ones',
    pages: 320,
  },
  {
    title: 'Choose Your Enemies Wisely: Business Planning for the Audacious Few',
    author: 'Patrick Bet-David',
    about:
      "A book that emphasizes the importance of identifying and understanding one's adversaries to succeed in the business world",
    pages: 304,
  },
  {
    title: 'The Embedded Entrepreneur',
    author: 'Arvid Kahl',
    about: 'A book focusing on how to build an audience-driven business',
    pages: 308,
  },
  {
    title: 'How to Be a Coffee Bean: 111 Life-Changing Ways to Create Positive Change',
    author: 'Jon Gordon',
    about: 'A book about effective ways to lead a coffee bean lifestyle',
    pages: 256,
  },
  {
    title: 'The Creative Mindset: Mastering the Six Skills That Empower Innovation',
    author: 'Jeff DeGraff and Staney DeGraff',
    about: 'A book on how to develop creativity and  innovation skills',
    pages: 168,
  },
  {
    title: 'Rich Dad Poor Dad',
    author: 'Robert Kiyosaki and Sharon Lechter',
    about: 'A book about financial literacy, financial independence, and building wealth. ',
    pages: 336,
  },
  {
    title: 'Zero to Sold',
    author: 'Arvid Kahl',
    about: 'A book on how to bootstrap a business',
    pages: 500,
  },
];

function displayBooks(catalog) {
  let output = 'Books in the Library:\n';

  catalog.forEach((book) => {
    output += `- ${book.title} by ${book.author} (${book.pages} pages)\n`;
  });

  return output;
}

function getBookSummaries(catalog) {
  return catalog.map((book) => book.about);
}

// User Editable Region

function getBooksByAuthor(books, author) {
  const booksByAuthor = books.filter(book => book.author.includes(author));
  return [...booksByAuthor, `Total books in library: ${books.length}`];
}

console.log(getBooksByAuthor(library, 'Patrick Bet-David'));

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0

Challenge Information:

Build a Library Manager - Step 6

The instructions don’t ask you to actually return the number. When it says “Your function should return the correct number of books” is failing, that means your function is returning either more or fewer books than the expected result.

in the console the amount of books by authors is correct…

function getBooksByAuthor(books, author) {
  return books.filter(book => book.author.includes(author));
}

console.log(getBooksByAuthor(library, 'Patrick Bet-David'));
console.log(getBooksByAuthor(library, 'Arvid Kahl')); 
console.log(getBooksByAuthor(library, 'James Clear'));  
console.log(getBooksByAuthor(library, 'Jon Gordon'));  
console.log(getBooksByAuthor(library, 'Robert Kiyosaki'));
[ { title: 'Your Next Five Moves: Master the Art of Business Strategy',
    author: 'Patrick Bet-David and Greg Dinkin',
    about: 'A book on how to plan ahead',
    pages: 320 },
  { title: 'Choose Your Enemies Wisely: Business Planning for the Audacious Few',
    author: 'Patrick Bet-David',
    about: 'A book that emphasizes the importance of identifying and understanding one\'s adversaries to succeed in the business world',
    pages: 304 } ]
[ { title: 'The Embedded Entrepreneur',
    author: 'Arvid Kahl',
    about: 'A book focusing on how to build an audience-driven business',
    pages: 308 },
  { title: 'Zero to Sold',
    author: 'Arvid Kahl',
    about: 'A book on how to bootstrap a business',
    pages: 500 } ]
[ { title: 'Atomic Habits',
    author: 'James Clear',
    about: 'A practical book about discarding bad habits and building good ones',
    pages: 320 } ]
[ { title: 'How to Be a Coffee Bean: 111 Life-Changing Ways to Create Positive Change',
    author: 'Jon Gordon',
    about: 'A book about effective ways to lead a coffee bean lifestyle',
    pages: 256 } ]
[ { title: 'Rich Dad Poor Dad',
    author: 'Robert Kiyosaki and Sharon Lechter',
    about: 'A book about financial literacy, financial independence, and building wealth. ',
    pages: 336 } ]

Is it? Is an author value of Robert Kiyosaki and Sharon Lechter the same as an author argument of Robert Kiyosaki?