Build a Plant Nursery Catalog - Step 21

Tell us what’s happening:

Sorry, your code does not pass. You’re getting there.

Your displayCatalog function should log each value contained in catalog to the console.

Your code so far

const ballerina = {
    commonName: "Spanish lavender",
    scientificName: "Lavandula stoechas",
    cultivar: "Ballerina"
}

const prettyPolly = {
    commonName: "Spanish lavender",
    scientificName: "Lavandula stoechas",
    cultivar: "Pretty Polly"
}

const willowVale = {
    commonName: "Spanish lavender",
    scientificName: "Lavandula stoechas",
    cultivar: "Willow Vale"
}

const hidcote = {
    commonName: "English lavender",
    scientificName: "Lavandula angustifolia",
    cultivar: "Hidcote"
}

const imperialGem = {
    commonName: "English lavender",
    scientificName: "Lavandula angustifolia",
    cultivar: "Imperial Gem"
}

const royalCrown = {
    commonName: "French lavender",
    scientificName: "Lavandula dentata",
    cultivar: "Royal Crown"
}

const catalog = new Map();
catalog.set(ballerina, { small: 20, medium: 15, large: 12 });
catalog.set(prettyPolly, { small: 31, medium: 14, large: 24 });
catalog.set(willowVale, { small: 3, medium: 5, large: 0 });
catalog.set(hidcote, { small: 33, medium: 13, large: 18 });
catalog.set(imperialGem, { small: 19, medium: 35, large: 28 });
catalog.set(royalCrown, { small: 40, medium: 22, large: 9 });

const removePlant = plant => catalog.delete(plant);

const sellPlants = (plant, size, potsNo) => {
    if (!catalog.has(plant)) return "Item not found.";
    const name = `${plant.scientificName} '${plant.cultivar}'`
    const pots = catalog.get(plant);
    if (pots[size] - potsNo < 0) {
        return `Not enough ${size} size pots for ${name}. Only ${pots[size]} left.`
    }
    pots[size] -= potsNo;
    return `Catalog successfully updated.`

// User Editable Region

}
function displayCatalog() {
  for (const [plant, inventory] of catalog.entries()) {
    console.log(inventory);
  }
}


displayCatalog();

// User Editable Region

Your browser information:

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

Challenge Information:

Build a Plant Nursery Catalog - Step 21

what should i do please tell me

do not use destructuring, use a single variable for the loop and print that

still its not working

function displayCatalog() {

for (let entry of catalog.entries()) {

console.log(entry\[0\], entry\[1\]);

}

}

displayCatalog();

Sorry, your code does not pass. Hang in there.

Your displayCatalog function should log each value contained in catalog to the console.

this is what iys showing

you are not printing just the loop variable now

i dont understand can you simplify it

what is the loop variable? can you identify it?

2. Your displayCatalog function should log each value contained in catalog to the console.
// tests completed
// console output
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Ballerina' } { small: 20, medium: 15, large: 12 }
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Pretty Polly' } { small: 31, medium: 14, large: 24 }
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Willow Vale' } { small: 3, medium: 5, large: 0 }
{ commonName: 'English lavender',
  scientificName: 'Lavandula angustifolia',
  cultivar: 'Hidcote' } { small: 33, medium: 13, large: 18 }
{ commonName: 'English lavender',
  scientificName: 'Lavandula angustifolia',
  cultivar: 'Imperial Gem' } { small: 19, medium: 35, large: 28 }
{ commonName: 'French lavender',
  scientificName: 'Lavandula dentata',
  cultivar: 'Royal Crown' } { small: 40, medium: 22, large: 9 }
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Ballerina' } { small: 20, medium: 15, large: 12 }
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Pretty Polly' } { small: 31, medium: 14, large: 24 }
{ commonName: 'Spanish lavender',
  scientificName: 'Lavandula stoechas',
  cultivar: 'Willow Vale' } { small: 3, medium: 5, large: 0 }
{ commonName: 'English lavender',
  scientificName: 'Lavandula angustifolia',
  cultivar: 'Hidcote' } { small: 33, medium: 13, large: 18 }
{ commonName: 'English lavender',
  scientificName: 'Lavandula angustifolia',
  cultivar: 'Imperial Gem' } { small: 19, medium: 35, large: 28 }
{ commonName: 'French lavender',
  scientificName: 'Lavandula dentata',
  cultivar: 'Royal Crown' } { small: 40, medium: 22, large: 9 }

that does not look like the loop variable, do you know what the loop variable is?

Here, the loop variable is entry.

have you tried just printing that?

Thank you it worked..