To add a public property to a class in Javascript, you need to first define the class, then add the property to the class definition as shown in the code block below:
index.tsx576 chars28 lines
In the above code, the name
property is defined as a getter/setter pair inside the class definition, which allows it to be accessed and modified publicly outside of the class. To access the property, simply create an instance of the class and call the property using the instance name.
gistlibby LogSnag