Build a Cargo Manifest Validator - Build a Cargo Manifest Validator

Tell us what’s happening:

My normalizeUnits function is returning a copy of the input manifest with the correct weight and units for inputs with weight in pounds and is passing all related tests except for 3. Is there a way to use the unit conversion supplied rather than the math that I am using or is there something else I am missing? I have tried looking for a solution and haven’t been able to find a sufficient one

Your code so far

function normalizeUnits(manifest) {
  let check = { ...manifest}
  if (check.unit === "lb") {
    check.weight *= 0.45
    check.unit = "kg"
    return check
  }
}

console.log(normalizeUnits({ containerId: 68, destination: "Salinas", weight: 101, unit: "lb", hazmat: true }))

Your browser information:

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

Challenge Information:

Build a Cargo Manifest Validator - Build a Cargo Manifest Validator

Welcome to the forum @VulpineVee !

Should your function return an object only when it needs to convert the weight?

Happy coding!