diff --git a/debugging/demo/demo1/demo1.js b/debugging/demo/demo1/demo1.js index 0d8e695..2a30c02 100644 --- a/debugging/demo/demo1/demo1.js +++ b/debugging/demo/demo1/demo1.js @@ -1,15 +1,19 @@ -const tomatoes = 'tomatoes'; -const chocolate= 'chocolate'yummy'; -const yogurt = 'yogurt'; +const tomatoes = "tomatoes"; +const chocolate= "chocolate yummy"; +const yogurt = "yogurt"; const rice = "rice"; -const fridge =[{ item: tomatoes, quantity: 5}, - { item: chocolate, quantity: 1}, - { item: yogurt, quantity: 5}]; +const fridge =[ + { item: tomatoes, quantity: 5}, + { item: chocolate, quantity: 1}, + { item: yogurt, quantity: 5} + ]; -const wantedList = [{ item: tomatoes, quantity: 4}, +const wantedList = [ + { item: tomatoes, quantity: 4}, { item: chocolate, quantity: 10}, - { item: yogurt, quantity: 2}] + { item: yogurt, quantity: 2} +]; const shoppingList = (fridge, wantedList) => { return wantedList.map(groceryWantedList => { @@ -22,14 +26,13 @@ const shoppingList = (fridge, wantedList) => { item: groceryWantedList.item, quantity: groceryWantedList.quantity - groceryFridge.quantity }; - } - else{ + } else{ return null; } } }).filter(item => item !== null); }; -shoppingList (fridge, wantedList).forEach( (item) => { +shoppingList(fridge, wantedList).forEach((item) => { console.log (`${item.item}: ${item.quantity}`); }) \ No newline at end of file diff --git a/debugging/demo/demo2/index.html b/debugging/demo/demo2/index.html index 8cc1a42..0f09c84 100644 --- a/debugging/demo/demo2/index.html +++ b/debugging/demo/demo2/index.html @@ -1,6 +1,5 @@
- Javascript Demo Exercise 2 + diff --git a/debugging/demo/demo2/script.js b/debugging/demo/demo2/script.js index 1c7bec9..921526a 100644 --- a/debugging/demo/demo2/script.js +++ b/debugging/demo/demo2/script.js @@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", ( ) => { } ]; for (var i = 0; i