Accessing an objects parent class

E

eggie5

See the below objects:

function Manager()
{
this.reports=new Reports();
}

function Reports()
{
//How do I access Manager from here?
}
 
R

RobG

See the below objects:

function Manager()
{
this.reports=new Reports();
}

function Reports()
{
//How do I access Manager from here?
}

You can get the function that called a function using:

arguments.callee.caller;

so

function Reports() {
//How do I access Manager from here?
var caller = arguments.callee.caller;
}

does the job in those browsers that support it (Firefox and Safari at
least, I don't think IE does) - but I can't see how that's useful.

It is usually better to explain what you are trying to do at a higher
level, then maybe someone will tell you how to do it, rather than
asking for how to do something explicit that has no obvious rationale.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top