Menu
Coddy logo textTech

Designing the Library

Part of the Object Oriented Programming section of Coddy's JavaScript journey — lesson 50 of 56.

challenge icon

Challenge

In this project we'll build a library system where books track authors and availability.

Your task:

  1. In the file called Author.js, create an Author class with:
    • A constructor that takes one parameter: name
    • It should store the name as: this.name = name
  2. Export the class using export
  3. 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