Currently Running Javascript Function Name?
This works fine AFAIK: (function f() { console.log(f.name); //logs f })(); But some of the answers posted here are a lot longer, which makes me think that I might be missing
Solution 1:
The Function.name
property is only available in ES6/ES2015-compliant engines. So for example if you try to access it without additional configuration in Typescript you will get the error:
[ts] Property 'name' does not exist on type 'Function'.
So for typescript include es2015
in your --lib value to get the property declaration.
{
"compilerOptions": {
...
"lib": ["es2015"], /* Specify library files to be included in the compilation. */
...
}
Post a Comment for "Currently Running Javascript Function Name?"