Archived
backing project code
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js"></script>
|
||||
<script src="shopping-list.js"></script>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user