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
processManifestfunction should log a success message with the object’scontainerId, and then log the object’sweightin kilograms. You should usenormalizeUnits()for the conversion and have twoconsole.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.