doesNotUnderstand for JavaScript?
Is there a way to si开发者_运维百科mulate Smalltalk's doesNotUnderstand or Ruby's method_missing in Javascript?
There is no catch-all method defined in the JavaScript standard, but Mozilla implements the non-standard __noSuchMethod__
for SpiderMonkey and Rhino (including Firefox obviously).
You may also be interested in checking out @CMS' answer given to the following Stack Overflow question:
- Is there an equivalent of the noSuchMethod feature for properties, or a way to implement it in JS?
精彩评论