I defined a class:
export class SavedData{
public isDone : boolean;
}
and try to stringify it:
console.log(new SavedData());
but it doesn't include the isDone property
{}
,which I need to move isDone to constructor:
export class SavedData{
constructor(public isDone : boolean){
}
}
to be successful:
{"isDone":false}
why would it happen? and is it possible to stringify a class property without declaring it into constructor?
JSON.stringify?