"method_missing" for javascript

P

pedz

Is there a way to implement a type of "method_missing" concept that Ruby has? Or, equally likely, a javascript way of fulfilling the same need.

The method_missing method defined for object foo is called when foo.whatever(args) is called and whatever is not defined. The method is passed the name (whatever in this case) along with args.

Obviously I can define a function call blah and then instead of calling foo.whatever(args), I can call foo.blah("whatever", *args) but the "blah" is distracting in this case. I'm wondering if there is a way to make the "blah" not be needed.

Thank you,
pedz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top