Page 1 of 1

Calling a function defined inside another function

Posted: Fri Feb 02, 2018 8:47 pm
by ajk48n
I am trying to call a function that is defined inside another function. So say I have this:

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:
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