victorgr (victorgr) wrote in webdev,
victorgr
victorgr
webdev

Catch undefined method calls in JS

Hi!

There is an interesting task. I need to catch any undefined calls in my JS code. Is there a solution?

Imagine:
    function a() {
        alert('Hi, I'm a function!');
    }

    a(); // works great

    a.b(); // call undefined function


So, are there any ways to catch calls a.b() in my function a()?
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 5 comments