Click to See Complete Forum and Search --> : Determining Function Name?


hnorris
02-10-2003, 02:46 PM
Hi -

Does anybody know any tricks for how a function can determine it's name (in string form) from inside itself, from within the function's executing code body? Perhaps there's a function object identifier property available? Thanks for your thoughts!

- Hnorris

Charles
02-10-2003, 02:56 PM
You can find listed all of he methods and properties of Functions in JavaScript 1.3 at http://developer.netscape.com/docs/manuals/js/client/jsref/function.htm. And no, there is no Function.name property.

I'm a little confused. Why would you ever need such a thing?

Dan Drillich
02-10-2003, 06:22 PM
A function in JS is data, which can be pointed to from multiple places, so it can have multiple names and on the other hand it might not have a name at all.

Cheers,
Dan