I have seen creating the base class as following way in one of the Node.js project. I can't understand why the datatype is used next to the pipe operator. I'm not sure if this is the right way to create properties for a class.
I am sure this.name = name || ""
is the right way. I just want to know if this.name = name || String;
is also right way to create properties of class.
class MeetingBase {
constructor(name, startdate, enddate, active) {
this.name = name || String;
this.startdate = startdate || Date;
this.enddate = enddate || Date;
this.active = active || Boolean;
}
}