How can I add a dynamic property with multiple attributes? I tried with backticks, but it did not work.
function User(userID){
this.userID = userID;
this.printUserDetails = function(){
console.log(userID);
}
}
const user=new User('A1234');
user.tokenID='jsessionID=12345678';
user.tokenValidity={
startDate:07042020
//What is the syntax to add end date here for e.g. endDate:08042020?
}
user.tokenValidity.endDate = 08042020? Or what do you mean by dynamic property. I seeuseris of typeUser. Do you want to addendDateto the constructor functionUser, or just touser? If the second option is true, you should be able to add it as I mentioned. If not, please provide more details as what is the error you get and what do you do to get the error.