I am dealing with a class setup as follows:
export class Car{
color='';
topSpeed=0;
wheels = 4;
}
Within my Firestore database, there exists a document titled "car" with values:
color:red
topSpeed:230
(note that the 'wheels' key is missing)
Upon retrieving and assigning data, the process resembles something like this:
firebaseController.getCar().subscribe(car=>{
this.car = car
}
While everything seems to be functioning properly, the issue arises when the 'wheels' property gets overwritten with "undefined". Is there a way to prevent variables from being overwritten if a key does not exist or if the value for that key is null?