Javascript - Function call will not enter function body

Posted by Mike S on Stack Overflow See other posts from Stack Overflow or by Mike S
Published on 2010-06-16T19:40:26Z Indexed on 2010/06/16 20:02 UTC
Read the original article Hit count: 147

Filed under:

I have a function acting as a constructor that, when called, gets as far as the function definition in the debugger, but never to the function body. Is there a common reason this may happen that I am overlooking? Example code below:

myconstructor.js

function MyConstructor(optionalParam) { //this breakpoint gets hit
    var newobj = {}; //breakpoint never hit
    //code to check for null parameter
    //other code
};

main.js

var myConstructor = new MyConstructor();

There must be something I have overlooked, but I can't see what that is. Neither firefox/firebug nor VS report errors or warnings.

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript