Javascript – How to find the optimal products with the lowest price amount with the highest quantity?
I tried to write a function for myself but it somehow incorrectly outputs the final result: function findOptimalProducts(products, budget) { const getPrice = (priceString) => parseFloat(priceString.replace(/,/g, "")); const getQuantity = (quantityString) => parseFloat(quantityString.slice(1).replace(/K/g, "")) * (quantityString.endsWith("K") ? 1000 : 1);…