@@ -0,0 +1,2431 @@
+/*%0APseudocode:%0AMethod to create a list:%0Ainput: list name%0Asteps: print and return list%0Aoutput: Object%0A%0AMethod to add an item to the list:%0Ainput: item name and optional quantity and list name%0Asteps: Add item name and quantity to list as property/value%0Aoutput: return update list%0A%0AMethod to remove an item from the list:%0Ainput: list name, item name%0ASteps: remove item from list%0Aoutput: return updated list%0A%0AMethod to update quantity of item:%0Ainput: list name, item name, new quantity%0ASteps: Change quantity for item to new quantity%0Aoutput: return updated list%0A%0AMethod to print list:%0Ainput: list name%0ASteps: print title of list%0A        print each item of list on its own line%0Aoutput: printed list%0A*/%0A%0A// initial solution%0A%0Afunction create() %7B%0A  return new Object();%0A%7D%0A%0Afunction add(map, item_name, item_quantity)%7B%0A  map%5Bitem_name%5D = item_quantity;%0A%7D%0A%0Afunction remove(map, item_name)%7B%0A  delete map%5Bitem_name%5D;%0A%7D%0A%0Afunction update(map, item_name, new_quantity)%7B%0A  add(map, item_name, new_quantity);%0A%7D%0A%0Afunction printList(map)%7B%0A  console.log(%22GROCERY LIST%22);%0A  for(var item in map)%7B%0A    console.log(item + %22 %22 + map%5Bitem%5D);%0A  %7D%0A%7D%0A%0Avar grocery = create();%0Aadd(grocery, %22apple%22, 1);%0Aadd(grocery, %22pear%22, 2);%0AprintList(grocery);%0Aremove(grocery, %22pear%22);%0AprintList(grocery);%0Aupdate(grocery, %22apple%22, 2);%0AprintList(grocery);%0A%0A//Refactor%0A// I did not see any refactoring that was necessary%0A%0Afunction create() %7B%0A  return new Object();%0A%7D%0A%0Afunction add(map, item_name, item_quantity)%7B%0A  map%5Bitem_name%5D = item_quantity;%0A%7D%0A%0Afunction remove(map, item_name)%7B%0A  delete map%5Bitem_name%5D;%0A%7D%0A%0Afunction update(map, item_name, new_quantity)%7B%0A  add(map, item_name, new_quantity);%0A%7D%0A%0Afunction printList(map)%7B%0A  console.log(%22GROCERY LIST%22);%0A  for(var item in map)%7B%0A    console.log(item + %22 %22 + map%5Bitem%5D);%0A  %7D%0A%7D%0A%0A/*%0AWhat concepts did you solidify in working on this challenge? (reviewing the passing of information, objects, constructors, etc.)%0A%0A  I solidified calling objects and their properties individually. Also, I solidified basic syntax for JavaScript.%0A%0AWhat was the most difficult part of this challenge?%0A%0A  I had trouble getting the list to print in a more pretty way. I think it came out ok though.%0A%0ADid an array or object make more sense to use and why?%0A%0A  I used an object. With an object it is easy to store the property as the item name and the value as the quantity. With an array, I would not be able to link the item to the quantity as easily.%0A%0A*/

Add 9.2 solution