Hi,
I am trying to learn javascript, and I have the code below. I need to perform calculations with some of my object properties, -find a sum and find the biggest area, for example-. I don't know if I should create an array with my objects (and I don't know how to do this) and then iterate through them. I don't know if this will be the best approach.
class Park{
constructor(name, buildYear, area, noOfTrees){
this.name = name;
this.buildYear = buildYear;
this.area = area;
this.noOfTrees = noOfTrees;
}
const prk1 = new Park('Park1', 1980, 80, 1200);
const prk2 = new Park('Park2', 1972, 180, 2200);
const prk3 = new Park('Park3', 1990, 120, 1600);
Thank you very much for your help.
Andrea
What I have tried:
I have not tried anything yet and I don't know where to start.