- I can assign a unique index to a python class data member like here.
- Is there an equivalent in typescript?
class Person
{
index: number
age: number
name: string
constructor(age: number, name: string)
{
// this.index = fresh index every time
this.age = age;
this.name = name;
}
}
CodePudding user response:
Following the suggestion of @mahooresorkh, using static
solves it:
class Person
{
index: number
age: number
name: string
// arrggghh this is ugly