AnnaMTerris / BuildALibrary

JavaScript Classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript Classes

Ojective: to learn JavaScript syntax: Classes

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

  1. Book
  • Properties: author (string), title (string), pages (number), isCheckedOut (boolean, initially false), and ratings (array, initially empty).
  • Getters: all properties have a getter
  • Methods: .getAverageRating(), .toggleCheckOutStatus(), and .addRating()
  1. Movie
  • Properties: director (string), title (string), runTime (number), isCheckedOut (boolean, initially false), and ratings (array, initially empty)
  • Getters: all properties have a getter
  • Methods: .getAverageRating(), .toggleCheckOutStatus(), and .addRating()
  1. CD
  • Properties: artist (string), title (string), isCheckedOut (boolean, initially false), and ratings (array, initially empty), songs (array of strings)
  • Getters: all properties have a getter
  • Methods: .getAverageRating(), .toggleCheckOutStatus(), and .addRating()

Exercise provided by Codecademy

About

JavaScript Classes


Languages

Language:JavaScript 100.0%