How do I reset the values in a class in Typescript and ensure all the values are cleared? Is there a typescript function to do this?
export class Product{
productId: number;
productName: string;
productDescription: string;
}
We have many classes with 50+ fields, looking for efficient way to conduct this.
Try like this:
productDetails: Product = {
productId: 1,
productName: "Apple",
productDescription: "Fruit"
};
reset() {
this.productDetails = new Product();
}