Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Now that we have some basic objects to play with, let's flesh them out by adding some methods. We'll start with methods to add books and patrons to the Library objects.
Instructions for Workspace
Your instructions are as follows:
1) In the Library.js file, add two methods to the Library class: addPatron()
and addBook()
addPatron()
receives one argument, a Patron object. This object (stored in thepatron
variable) should be added to the Library object's (stored in thelibrary
variable)patrons
property, which is an array.addBook()
receives one argument, a Book object. This object (stored in thebook
variable) should be added to the Library object'sbooks
property, which is an array.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up