Designing the Library
Part of the Object Oriented Programming section of Coddy's JavaScript journey — lesson 50 of 56.
Challenge
In this project we'll build a library system where books track authors and availability.
Your task:
- In the file called
Author.js, create anAuthorclass with:- A constructor that takes one parameter:
name - It should store the name as:
this.name = name
- A constructor that takes one parameter:
- Export the class using
export - In
main.js, import the class
Try it yourself
// TODO: import the Author class here
// Tests
const author = new Author('J.K. Rowling');
console.log(author.name); // "J.K. Rowling"All lessons in Object Oriented Programming
1Objects & The this Keyword
Quick Review: ObjectsAdding Methods to ObjectsUnderstanding the this KeywordConstructor FunctionsThe new KeywordRecap Challenge7 Inheritance & The extends Key
InheritanceThe "is-a" RelationshipThe extends KeywordThe super() MethodInheriting Properties&MethodsRecap Challenge2Organizing Code
What are Modules?Exporting with exportImporting with importDefault vs. Named Exports8Organizing OOP Code
Organize Classes into Modules11Project: A Shape Renderer
Setup: Shape Class & ExportCircle Class Inheritance9Static Methods & Properties
Class-Level vs. Instance-LevelStatic PropertiesStatic Utility MethodsRecap challenge