I need to set up two flags canPlayLive
and isSubscribed
to true
or false
accordingly to values of parameters sent when creating the object.
Basically when null
undefined
''
is passed I want the flag on false
, otherwise on true
.
Using the following code flags are always on true
.
What am I doing wrong here?
function MyStation(id, chId, name, hdImg, subscribedFlag, liveEntryId, liveUrl, timeLists) {
this.id = id;
this.dataId = chId;
this.name = name;
this.imageUrl = hdImg;
this.subscribedFlag = subscribedFlag;
this.liveEntryId = liveEntryId === null || undefined || '' ? null : liveEntryId;
this.liveUrl = liveUrl === null || undefined || '' ? null : liveUrl;
this.timeLists = timeLists;
this.canPlayLive = this.liveUrl === null || undefined || '' ? false : true;
this.isSubscribed = subscribedFlag == 0 ? false : true;
}
var test = new MyStation(
0,
'x123',
'foo',
'url',
0,
null,
'',
[]
);
console.log(test);