[Javascript] accessing nested functions
Brian L. Matthews
blmatthews at gmail.com
Sat Jul 7 12:27:21 CDT 2007
Pedro Mpa wrote:
> If I add "new" to function declaration, when I call "test = new a();" the
> code inside function b is executed too, and that’s not what I intended.
You can't have it both ways, either b is executed and c set, or b isn't
executed and c isn't set.
> I was looking for the PHP class->function type of behaviour but with function
> nesting which isn't allowed in PHP.
>
I strongly recommend that you google for tutorials about JavaScript's
brand of OO and read them. JavaScript isn't PHP, and trying to write
JavaScript as if it's "PHP + nested functions" will surely lead to madness.
Brian
More information about the Javascript
mailing list