In PHP you can detect when a method is called even when it doesn\'t exist using the \"magic\" __call
function.
public function __call($methodNam
No. Due to the way JavaScript works, the equivalent would be like Python's __getattr__
/__getitem__
, rather than PHP's __call
, as it would need to be dealt with when retrieving the attribute rather than when calling it.
Then, you can look at a question like Python's __getattr__ in Javascript which answers it in that way.
See also such questions as these: