Coder Social home page Coder Social logo

js-cla-build-a-library's Introduction

How to run and test?

As previous tasks it uses yarn and jest testing framework so the process is the same:

  1. git clone the repo.
  2. Create new branch with your name and checkout.
  3. Run yarn.
  4. To run tests: run yarn test or yarn watch depending on your preference.

Build a Library

Congratulations, you’ve passed the grueling rigmarole of librarian school and have become head librarian at your local Books-‘N-Stuff.

Just as you sit down, eager to utilize all those skills you learned in “Lib 203 - Shushing: How to Maintain Order While Spitting”, you realize you’re still using index cards to handle everything.

But no matter, you know some JavaScript, so let’s get to work modernizing your new digs.

Books-‘N-Stuff carries three different types of media: books, CDs, and movies. In this project you will create a parent class named Media with three subclasses: Book, Movie, and CD. These three subclasses have the following properties and methods:

Book

Properties:

  • author: string
  • title: string
  • pages: number
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

Movie

Properties:

  • director: string
  • title: string
  • runTime: number
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

CD

Properties:

  • artist: string
  • title: string
  • isCheckedOut: boolean, initially false
  • ratings: array, initially empty
  • songs: array of strings

Getters: all properties have a getter

Methods:

  • .getAverageRating()
  • .toggleCheckOutStatus()
  • .addRating()

After you implemented each of them in resources.js, inside index.js:

  • create an object at least from one of the class type
  • console.log each getter's value
  • test each method's behavior

js-cla-build-a-library's People

Contributors

bahriddin avatar

Watchers

James Cloos avatar  avatar Oybek Turaev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.