Quiz: Book Constructor Copy

For this exercise you will write a constructor for making "book" objects. This object should have the following properties: title, author, the number of pages, and whether or not you have read the book.

Put a function into the constructor that can report the book info like so

book.info() // "The Hobbit by J.R.R. Tolkien, 295 pages, not read yet"

Important Note: It is better to return things rather than putting console.log() directly into the function. In this case, return the info string and log it after the function has been called:

console.log(theHobbit.info());

Create a new repo named js-object-constructors, add your instructor(s) as collaborator(s) and submit its URL.

Leave a Reply