Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ramirori/Lab17_01.03.23_ConstructorsAndPrototypes_JavaScript

Open more actions menu

Repository files navigation

Lab Exercise 01/03/23 - Constructors & Prototypes

In this exercise we explored some of the differences between how classes are defined in Java and JavaScript. Used a car dealership format and created the classes, including their properties and behaviours, using JavaScript.

Created project from scratch and installed dependencies (hint: npm install -D jest).

Task

  • Created Car class. The car has properties representing manufacturer, price and engine type.
  • Set up Jest and wrote tests to ensure accessibility to each of the properties in a Car object.
  • Created a Dealership class. It contains properties representing its name, maximum number of cars it has and the cars currently in stock.
  • Added methods to Dealership to:
    • Counted the number of cars in stock
    • Added a car to stock
    • Returned an array containing each car's manufacturer
    • Found all the cars from a given manufacturer
    • Found the total value of all the cars in stock
  • Wrote tests for Dealership's methods.

About

Car dealership: Created classes, including their properties and behaviours, using JavaScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.