In comp.lang.javascript message
<11*********************@l12g2000cwl.googlegroups. com>, Tue, 12 Dec 2006
14:42:10, web.dev <we********@gmail.comwrote:
If you are passing a
reference to your function, you may invoke it directly. For example:
function x(fnc_ref)
{
fnc_ref();
}
And if you need the name of the current fnc_ref within function x,
Str = fnc_ref.toString().match(/function\s+(\w+)\W/)[1]
will do it for reasonably-named functions in at least some browsers.
For the general case, improve the RegExp.
Query : is there nowadays a respectable means XXXX of getting a
reference to a function given only its name ?
e.g. ISNAN == XXXX("isNaN")
Of course, XXXX being eval should do it; could that be deemed an
acceptable use, or is there a more specific alternative?
It's a good idea to read the newsgroup and its FAQ. See below.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
<URL:http://www.jibbering.com/faq/ Old RC FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.