Set default value of boolean typescript

I would add a default constructor and do something like this :

export class ReccurrenceModel {
    fromDate: Date;
    toDate: Date;
    weeklyReccurrence: number;
    state: State;
    isMonday: boolean;
    isTuesday: boolean;
    isWednesday: boolean;
    isThursday: boolean;
    isFriday: boolean;
    fromDateToReturn: Date;
    toDateToReturn: Date;

    constructor(){
      this.isMonday = false;
      this.isTuesday = false;
      this.isWednesday = false;
      this.isThursday = false;
      this.isFriday = false;
    }
}

later i would do something like this : ,

this.reccurrence = new ReccurrenceModel();

The above line would initialize the required fields. you can confirm this by doing a console.log(this.reccurrence) after calling the constructor


Doesn't make any big change in UI level you can use either. Both are falsy values for UI.

You can set anyone.

variableName = false 

or

variableName: boolean;

variableName you can use either UI consider it as false by default untill you assign its value to true.