Build an Artifact Provenance Auditor - Step 19

Tell us what’s happening:

My solution is not being recognized although it is already showing the expected result on the freecodecamp’s console.

It keeps showing this:

buildSummary should build the summary from any artifact’s own values, one field per line and in order.

console:

  Golden Mask
  Category: Ceremonial
  Curator: Fran Sinclair
  Current Gallery: Hall C
  On Display: true

Your code so far

const collection = {
  101: {
    title: "Golden Mask",
    category: "Ceremonial",
    curator: {
      id: 201,
      name: "Earl Sinclair",
    },
    locations: [
      { gallery: "Hall A", year: 2020 },
      { gallery: "Hall C", year: 2024 },
    ],
    tags: ["gold", "egypt"],
    onDisplay: true,
  },
  102: {
    title: "Bronze Tablet",
    category: "Inscription",
    curator: {
      id: 202,
      name: "Robert Sinclair",
    },
    locations: [{ gallery: "Archive Wing", year: 2019 }],
    tags: ["bronze", "writing"],
    onDisplay: false,
  },
};

console.log(collection[101].title);
console.log(collection[101].curator.name);

function getArtifactTitle(id) {
  const artifact = collection[id];
  return artifact ? artifact.title : "Artifact not found";
}

console.log(getArtifactTitle(102));

function addTag(id, tag) {
  const artifact = collection[id];
  if (artifact && !artifact.tags.includes(tag)) {
    artifact.tags.push(tag);
  }
}

addTag(101, "royal");
console.log(collection[101].tags);

function moveArtifact(id, gallery, year) {
  const artifact = collection[id];
  if (artifact) {
    artifact.locations.push({ gallery, year });
  }
}

moveArtifact(102, "Hall B", 2026);
console.log(collection[102].locations);

function toggleDisplayStatus(id) {
  const artifact = collection[id];
  if (artifact) {
    artifact.onDisplay = !artifact.onDisplay;
  }
}

console.log(collection[102].onDisplay);
toggleDisplayStatus(102);
console.log(collection[102].onDisplay);

function updateCurator(id, name) {
  const artifact = collection[id];
  if (artifact) {
    artifact.curator.name = name;
  }
}

updateCurator(101, "Fran Sinclair");
console.log(collection[101].curator.name);

function buildSummary(id) {
  const artifact = collection[id];
  if (!artifact) {
    return "Artifact not found";
  }
  const currentLocation = artifact.locations[artifact.locations.length - 1];
// User Editable Region
  
  return ` 
  ${artifact.title}
  Category: ${artifact.category}
  Curator: ${artifact.curator.name}
  Current Gallery: ${artifact.locations[artifact.locations.length-1].gallery}
  On Display: ${artifact.onDisplay}
  `;
// User Editable Region
}

console.log(buildSummary(101));
even if I use currentLocation.gallery as in:
return ` 
  ${artifact.title}
  Category: ${artifact.category}
  Curator: ${artifact.curator.name}
  Current Gallery: ${currentLocation.gallery}
  On Display: ${artifact.onDisplay}
  `;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36

Challenge Information:

Build an Artifact Provenance Auditor - Step 19

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-artifact-provenance-auditor/6a57c331ae94fa4631b60872.md at main · freeCodeCamp/freeCodeCamp · GitHub

it looks like your string starts with \n and ends with \n, are you sure that is asked?

Oh okay, so it’s really a matter of spaces that messes up with the evaluation. Not really intuitive.

I had the exact same problem, I agree that’s really not very intuitive. basically the string must start inmediately after the backtick and finish exactly with the backtick.