I have an external class export class
as template for an object.
export class Car{
name: Boolean;
other: {
prize: String;
brand: String;
};
doors: {
number: String,
size: String,
};
}
I try to access it from another class, so I created a new variable
var car= new Car();
Since name
is a boolean
, I assume that it is initialized with a true
since it is its default value. My problem comes when I try to initialize the object% of% if it does not have it.
var car= new Car();
this.car.doors[pos].number;
When I try to access it, it tells me that doors
. How could I access it? I guess I need to initialize it in the constructor.
I do not need to initialize undefined