Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Assignment
- Create a document that you can share with your mentor (like a Google Doc, DropBox Paper, or Gist).
- For the 3 remaining user stories (add items, check/uncheck items, and delete items), plan out each function in pseudocode (plain language).
- addItem
- //utilize Jquery to listen to click of 'Add button' (or enter pressed while the input form is targetted)
- //prevent default behaviour to GET or POST if we are using a form element
- //create a new variable (nameToAdd) that will hold the string that is currently in the input form
- //Update the global variable shopping list to append the new object
- //object will have 3 keys, value pairs
- //1. unique id
- //2. name: nameToAdd
- //3. checked : false
- //re-render shopping list to reflect the new addition
- check.uncheck items
- //listen for an event where 'check-toggle' is clicked.
- //create a new variable (target-id) to identify the item to toggle
- //iterate through the global shopping list to locate item to update via target-id
- //update the attribute checked of the object targetted
- //re-render shopping list to reflect the new status of object targetted
- delete items
- //listen for an event where 'delete button' is clicked.
- //create a new variable (target-id) to identify the item to delete
- //iterate through the global shopping list to locate index of object to remove via target-id
- //remove the object from the global shopping list
- //re-render shopping list to reflect the new list without deleted object
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement