myObj = function MyObject(r) { this.Prop = r.Prop this.LogIn = new Date(r.LogIn) this.Created_Date = new Date(r.Created_Date) } How do I assign empty value "" if r.LogIn is null otherwise Date. Right now if LogIn is null, its assigning it to date 12-31-1969.
myObj = function MyObject(r) { this.Prop = r.Prop this.LogIn = function(r){ if(r.LogIn ==null){ return ""; } else{ return new Date(r.LogIn); } this.Created_Date = new Date(r.Created_Date) }
this.LogIn = r.LogIn ? new Date(r.LogIn) : "";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)