M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1zm. Join Stack Overflow to learn, share knowledge, and build your career. M9 1a8 8 0 1 0 0 16A8 8 0 e-aaria software solutions 0 9 1zM8 15.
How do you find out the caller function is ‘main’? Is there a way to find out the call stack at all? I hope this is just to aid you in debugging. Varying behaviour based on the caller is a bad idea. When would this be useful for debugging? Rather than combing through 1000s of LoC or arduous stepping through with the debugger, you can just see what was the stack at the time.
Note that this feature is non standard, from Function. This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. ES5 and removed in strict mode. It will only work, if you are not using strict mode.
Did not find what they wanted? Try here
CAN be accessed from within a function in strict mode, it would be stupid to deprecate that. Also, if you have a named argument, the arguments form of it will not track changes you make to the named version inside the function. This method has become obsolete since this post was listed in 2011. The preferred method is now Function. You will need to define function names for the stack trace to be legible.
An not even Chrome will be able to use the Klass name if you don’t give the name kls to the function. I didn’t find any real improvement by doing that. Not all browsers give you the same information. That is, parameters, code column, etc. But note that this name will be the one after the function keyword. Which will show the code of the caller function.
The nice thing is that this also gives you the line numbers where the caller called the function. The downside is that it limits the length of the stack to 10, which is why I came to this page in the first place. Could you please add a little more description about the explanation you provide? Gave me the info I needed — thanks!
Regarding the limit of stack length you can change that with “Error. Caller to get the calling function. This is the right answer these days. Wish we could get this moved to the top since all the other stuff is outdated now. Seems like this is not possible in strict mode? It might work for debugging, though.
I get errror message: ”’caller’ and ‘arguments’ are restricted function properties and cannot be accessed in this context. If you are not going to run it in IE console. And just for the function name use Hello. This is not on a standards track, but will work as of ECMAScript 5. ES5, and removed in strict mode.