From 512909e78124607eaf0e54bc58b6ec248d1b1612 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Wed, 17 Nov 2021 17:30:49 -0600 Subject: [PATCH] backing project code --- index.html | 14 ++++++++++++ shopping-list.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 index.html create mode 100644 shopping-list.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..5db5194 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + + + Document + + + + + diff --git a/shopping-list.js b/shopping-list.js new file mode 100644 index 0000000..74a7907 --- /dev/null +++ b/shopping-list.js @@ -0,0 +1,55 @@ +const script = "text/javascript" +script.src = "index.html" + +const dateTimeValue = new Date(); +const shoppingListArray = [ + +] + +const createfoodobj = (foodname, price, perdeim) => { + const newOBJ = { + name: foodname, + foodPrice: price, + quantityperitem: perdeim, + dateCreated: dateTimeValue + } + if (shoppingListArray.length < 1) { + newOBJ.id = 1 + } else { + + const lastIndex = shoppingListArray.length - 1 + const currentLastFoodItem = shoppingListArray[lastIndex] + const maxId = currentLastFoodItem.id + const idForNewFoodItem = maxId + 1 + newOBJ.id = idForNewFoodItem + } + + const number = newOBJ.foodPrice + console.log(number) + // const currencystring = number.format("$0,0.00") + // newOBJ.foodPrice = currencystring + +} + + + +const milk = createfoodobj("milk", 3.00, "gallon") +const eggs = createfoodobj("eggs", 0.69, "dozen") +const pizzaRolls = createfoodobj("pizza rolls", 6.99, "6 per package") +const filetMignon = createfoodobj("filet mignon", 12.99, "per lb") +const nutchrafelCheese = createfoodobj("nutchrafel cheese", 4.00, "8 oz") +const baklava = createfoodobj("baklava", 10.00, "3 pastries") + +// console.log(shoppingListArray) + +expensiveGroceries = [ + +] + +for(const fooditem of shoppingListArray) { + if (fooditem > `$${8.00}`) { + expensiveGroceries.push(fooditem) + console.log(expensiveGroceries) + } +} +