so i wonder how to initialize an array in a class constructor:
class test{
constructor(){
//here i want to initialize a new array called "array" from the class "class2"
let array = [new class2()]; //is this the way to do it?
}
add(x){
for(let i=0; i<array.length; i++){
if(array[i] == null){
array[i] = x;
break;
}
}
}
}
i want to make give that array some values of another class, like class2 has another constructor with some values (lets say name and age)
super()function to delegate values from class2