Build a Cargo Manifest Validator Step 21

UPDATE: I finished it. I just did

console.log(`Validation success: ${normalizeUnits(manifest).containerId}`);

and it worked.

Original Post:

Having trouble trying to pass Step 21. It’s telling me the following below

”If the input manifest object is valid, your processManifest function should log a success message with the object’s containerId, and then log the object’s weight in kilograms. You should use normalizeUnits() for the conversion and have two console.log() calls.”

My code is already working and I have passed Step 22 onwards and I can’t figure out how to fix this.

My code is shown below

const processManifest = (manifest) => {

  const objCopy = {...normalizeUnits(manifest)};

  if(Object.keys(validateManifest(objCopy)) == 0){

    console.log(`Validation success: ${objCopy.containerId}`);

    console.log(`Total weight: ${objCopy.weight} ${objCopy.unit}`);

  } else if (!Object.hasOwn(objCopy,"containerId")) {

      console.log(`Validation error: ${objCopy.containerId}`);

      console.log(validateManifest(objCopy));

  } else {

      console.log(`Validation error: ${objCopy.containerId}`);

      console.log(validateManifest(objCopy));

  }

Any idea how I can fix this? I really wanna finish this so I can move on to the next lesson.

Welcome to the forum @Aloloy

You have a message in the console:

SyntaxError: unknown: Unexpected token (23:3)

  21 |       console.log(validateManifest(objCopy));
  22 |
> 23 |   }
     |    ^

Where is the normalizeUnits function?

Happy coding

Hello @Teller,

I did not include my full code as to not show the whole working solution .

Hi @Aloloy

If your code is not working, you’ll need to post your full code so the forum can help you debug it.

Happy coding