Hello, I’m doing Build a Library in the Javascript lessons.
I had a question about constructor parameters but i still can’t seem to figure out the rule.
When we created class Media, the constructor has a parameter of ‘title’. I’m not sure why we don’t also include isCheckedOut and ratings as parameters as well.
Even further, when we create class Book extends Media, the parameters are (author, title, pages). I understand ‘author’ and ‘pages’ because they’re part of class Book only, but why only include ‘title’, and not ‘isCheckedOut’ or ‘ratings’? Those three all exist together inside the constructor of class Media.
Why is ‘title’ getting special treatment? If you’re going to omit ‘isCheckedOut’ and ‘ratings’ from the class Book constructor, why not omit ‘title’ as well?
I was really at a loss to decide which of the five parameters class Book has (title, isCheckedOut, ratings, author, pages) to include as Book constructor parameters.
Any enlightenment about this will be greatly appreciated.