Calling a function defined inside another function

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ajk48n
Posts: 20
Joined: January 17th, 2007, 3:02 pm

I am trying to call a function that is defined inside another function. So say I have this:

Code: Select all

function myFunc()
{
 
 function test()
 {
 alert("test');
 }
}
Is there any way to call test() without explicitly calling it inside of myFunc()?

For instance, I'd like to be able to call it like this:

Code: Select all

myFunc().test()

or

myFunc.test()

But in any case, I always get an error saying test() is undefined. Does anyone know how to accomplish this?

My end goal is to expose a function within my script so that external scripts can access it directly.

Thanks
Post Reply