Fwd: [Javascript] accessing nested functions
Noah Sussman
blinkdog at gmail.com
Sun Jul 8 09:02:11 CDT 2007
On 7/6/07, Pedro Mpa <mail.pmpa at sapo.pt> wrote:
> I'm having some trouble accessing nested functions, like in the following
> example, how can I access function c ?
>
> function a(){
> this.vara = "";
>
> this.b = function(){
> this.varb = "";
>
> this.c = function(){
> this.varc = "";
> alert('something');
> }
> }
> }
var f = new a();
var g = new f.b();
g.c();
You might also want to experiment with object literals, such as:
var a = {
vara : '',
b : {
varb : '',
c : function () {
varc : '',
alert('something');
}
}
}
a.b.c();
More information about the Javascript
mailing list