I want to be able to intercept access attribute to object which previously has not been set in JavaScript. I wonder if it's possible?
The equivalent in Python is the __getattr__
built-in method:
class P(object):
def __getattr__(self, name):
return name
p = P()
x = p.x
p.x doesn't previously exist, but __getattr__
intercept access to a member variable that has not previously been created. Anything similar in JavaScript?