Is It Possible To Access Class Properties Without Initialising The Class?
I want to access all of the properties of a class that will be defined when the constructor is called, so that I can implement a sort of interface for the class. Say I had a class
Solution 1:
In this situation, is it possible to access
hello
?
Not without using a JavaScript parser (like IDEs do to try to infer instance mbmers). hello
, as you say, doesn't exist as a property until/unless an instance is created. With a parser, you can (usually) determine what the property names will be, perhaps sometimes their initial values, but that's all.
Post a Comment for "Is It Possible To Access Class Properties Without Initialising The Class?"