diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b242572 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "githubPullRequests.ignoredPullRequestBranches": [ + "main" + ] +} \ No newline at end of file diff --git a/Object.css b/Object.css new file mode 100644 index 0000000..7fbc979 --- /dev/null +++ b/Object.css @@ -0,0 +1,99 @@ +.red { + /* color: red; */ + border: 1px solid red ; + padding: .5rem; + margin: .4rem; + font-size: 18px; + letter-spacing: 1px; +} +.normal { + border: 1px solid blue; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} +#list { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} + +#discountlist { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} + +.discount{ + border: 1px solid aqua; + margin-top: 5rem; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} + +#totaldiscount { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} + +.totaldsc{ + border: 1px solid magenta; + margin-top: 5rem; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} +#nondiscount { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} +.non-dsc{ + border: 1px solid darkorange; + margin-top: 5rem; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} + +#promo { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} + +.plusdiscount{ + border: 1px solid lawngreen; + margin-top: 5rem; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} + +#plusdsc { + display: flex; + flex-wrap: wrap; + justify-content: center ; + align-items: center; +} + +.total-dsc{ + border: 1px solid dimgrey; + margin-top: 5rem; + margin: .5rem; + padding: .4rem; + font-size: 18px; + letter-spacing: 1px; +} \ No newline at end of file diff --git a/Object.html b/Object.html new file mode 100644 index 0000000..47f1832 --- /dev/null +++ b/Object.html @@ -0,0 +1,35 @@ + + +
+ + + + +${Item.Item}
+${Item.Price}
+${Item.discount}
+${Item.Promo}
+${Item.Item}
+R ${Item.Price}
+Discount: ${Item.Price * Item.discount/100}
+Total: R ${Item.Price - Item.Price * Item.discount/100}
+Total Non-dsc Price: R ${pricediscount}
+Total Discount Price: R ${parseFloat(pricedsc.toFixed(2))}
+${Item.Item}
+R ${Item.Price}
+Plus discount: ${Item.discount + 10}%
+${Item.Promo}
+Total dsc Pecent: ${totaldsc}%
+${message}
`; +}; + +for(let a in keys) { + a%2? printData(`This has an even index: ${keys[a]}`): printData(`This has an Old Index: ${keys[a]}`) +} +keys.filter(key=> { + // key === "price" ? printData("Its A Price!"): printData(`Thats Something Else: ${key}!`); +}) + +const basketItems = [ + { + promo: true, + discount: 1, + price: 30, + item: "bread" + }, + + { + promo: true, + discount: 0, + price: 200, + item:"rice" + }, + + { + promo: true, + discount: 5, + price: 340, + item: "meat" + }, + + { + promo: true, + discount: 15, + price: 340, + item: "brai" + }, + + { + promo: true, + discount: 0, + price: 140, + item: "chicken" + }, + + { + promo: true, + discount: 5, + price: 100, + item: "soap" + }, + + { + promo: true, + discount: 2, + price: 70, + item: "cremora" + }, + + { + promo: true, + discount: 0, + price: 80, + item:"milk" + }, + { + promo: true, + discount: 0, + price: 200, + item: "bin" + }, + { + promo: true, + discount: 1, + price: 100, + item: "plastic" + }, + { + promo: true, + discount: 5, + price: 75, + item: "bin plastic" + }, +]; + +const basketDiv = document.getElementById("basket"); + +const name = "Kagisho Pitsi".split(" "); // type array ['Kagisho', "Pitsi"] + +const [item1,item2,item3,item4, item5, item6]=basketItems + +const {discount, price, item, promo} = item2 + + +const [name1, name2] = name // object destructuring + + +basketItems.map((item)=> { + // console.log(value) + basketDiv.innerHTML += `${item.item}
+${item.price}
+${item.discount}
+${item.promo}
+