// Array of products, each product is an object with different fieldset // A set of ingredients should be added to products var products = [ { name: "broccoli", vegetarian: true, glutenFree: true, organic: true, price: 1.99 }, { name: "bread", vegetarian: true, glutenFree: false, organic: false, price: 2.35 }, { name: "salmon", vegetarian: false, glutenFree: true, organic: false, price: 10.00 }, { name: "carrot", vegetarian: true, glutenFree: true, organic: true, price: 2.63 }, { name: "chicken", vegetarian: false, glutenFree: true, organic: false, price: 6.87 }, { name: "cereal", vegetarian: false, glutenFree: false, organic: false, price: 2.97 }, { name: "cheese", vegetarian: false, glutenFree: false, organic: false, price: 5.14 }, { name: "white fish", vegetarian: false, glutenFree: true, organic: false, price: 13.50 }, { name: "honey", vegetarian: false, glutenFree: false, organic: true, price: 1.89 }, { name: "onion", vegetarian: true, glutenFree: true, organic: true, price: 2.22 } ]; products.sort(function(a, b) { return a.price - b.price; }) // given restrictions provided, make a reduced list of products // prices should be included in this list, as well as a sort based on price function restrictListProducts(prods, restriction) { let product_names = []; for (let i=0; i -1){ totalPrice += products[i].price; } } return totalPrice; } function getItemPrice(chosenProduct){ for (let i=0; i -1){ return products[i].price; } } }