Build a Library Manager - Step 6

Tell us what’s happening:

I don’t understand what’s wrong
function getBookInformation(catalog) {
const title = library.map(catalog => catalog.title);
return title ;
}
console.log(getBookInformation(library))

Your code so far

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,
  },
];

console.log("Books in the Library:\n");


// User Editable Region

function getBookInformation(catalog) {
 const title =  library.map(catalog => catalog.title);
 return title ;
}
console.log(getBookInformation(library))


// User Editable Region

Your browser information:

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

Challenge Information:

Build a Library Manager - Step 6

use the map() method on the catalog parameter

Read that again, please. Does your code satisfy that requirement?

it return an array so i don’t understand

Are you using the map() method on the catalog parameter?

yes… i think. I use the exemple

You are using map() on library, not catalog.

yep as the exemple and it works…

i change it but i don’t understand it works the same

library is a global variable that you are passing to the getBookInformation() function. does it make sense to pass an argument to a function and then not use that parameter? and passing library into the function rather than accessing it directly inside the function means the function is self-contained and does not rely on external state…a good thing.

1 Like