Desarrollar un programa de gestión de inventario

No logro pasar desde el paso 12. Ayuda por favor

//Programa de gestión de inventario

const inventory = ;

function findProductIndex(productName) {

const lowerCaseProductName = productName.toLowerCase();

const index = inventory.findIndex(

(product) => product.name.toLowerCase() === lowerCaseProductName

);

return index;

}

function addProduct(product) {

product.name = product.name.toLowerCase();

// Buscar si el producto ya existe en el inventario

const existingProduct = inventory.find(item => item.name === product.name);



if (existingProduct) {

    // Si existe, actualizamos la cantidad

    existingProduct.quantity += product.quantity;

    console.log(\`${product.name} quantity updated\`);

} else {

    // Si no existe, lo agregamos al inventario

    inventory.push(product);

    console.log(\`${product.name} added to inventory\`);

}

}

function removeProduct(productName) {

// Normalizamos el nombre para que "FLOUR" y "flour" sean iguales

const nameToRemove = productName.toLowerCase();

// Buscamos el índice del producto

const index = inventory.findIndex(item => 

    item.name.toLowerCase() === nameToRemove

);

if (index !== -1) {

    // Extraemos el nombre real del producto antes de eliminarlo

    const removedProduct = inventory\[index\].name;

    // Remover del inventario

    inventory.splice(index, 1);

    console.log(\`${removedProduct} not found\`);

} else {

    console.log(\`${productName} not found\`);

}

}

addProduct({name: “FLOUR”, quantity: 5})

removeProduct(“FLOUR”, 5)

console.log(inventory);

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.