- Created a class Movies with constructor and in this class we have given three properties: title, studio, and rating:
- The constructor of the class Movies set the class property rating to "PG" as the default when no rating is provided
- Created a new object with the object name and passed the properties values
- Displayed the PG rated movies by using getPG method
- Get the code in the OOP in JS folder
- Created a class Circle with constructor and this we have two properties radius and colora:
- Displayed the radius and colour by using a getter
- Displayed the updated radius and colour by using a setter
- Calculated the area and circumference of the circle by using both the initial values and the updated values.
- Get the code in the OOP in JS folder
- Created a Person class to hold all the details of the person:
- In constructor, this class has some random information(properties) about the person
- Displayed the information of the person from the class by using getter and updated it by using setter
- Get the code in the OOP in JS folder
- Displayed the price detail of an Uber ride by using class in JS:
- Created a class UberPriceCalculation with constructor(baseFare, costPerKm, costPerMinute)
- Set values for this class by creating a new object with uberPriceCalculatio as an object name
- Calculated and displayed the Uber ride price for the given values
- Get the code in the OOP in JS folder