let's suppose I have a class:
class Intern{
constructor(name, mark) {
this.name = name
this.mark = mark
}
getMark() {return mark}
}
let a = new Intern('John', 10) // let's say I create 3 objects of this class
let b = new Intern('Marry', 9)
let c = new Intern('Anne', 8)
How I can pass an array of Interns as an argument to another class Mentor? I can create an empty array and do like this:
arr = []
Mentor{
constructor(name, arr){
this.name
this.arr
}
getMentorHappiness() = this.arr.Intern.mark * 2
}
Is that correct? So in dependent-ion on which mentor I select it will show me the only the get happiness method of these interns that only this Mentor teaches. Something like that:
let d = new Mentor('Dean', [Anne, John]
let e = new Mentor('Sam', [Marry])
I think I have to refer somehow to the info based on the Mentors array of objects input?
a,b, andc.Anne,John, andMarrydo not exist. What is the purpose ofarr = []?