问题
Possible Duplicate:
JavaScript getter for all properties
Does JavaScript provide a method to access undefined object properties? In PHP the solution is to declare and implement __get()
method in class.
Solutions using try { .. } catch { .. }
are not sufficient for me, because I already have very large amount of code which actually needs to stay as-is.
回答1:
You may choose to write a similar functionality and check existing parameters them against the arguments array. I'm not 100% that this will solve your problem.
来源:https://stackoverflow.com/questions/3959187/javascripts-equivalent-to-phps-get-magic-method