JavaScript developers who have spent time in languages like C often miss the ability to use certain types of introspection, like logging line numbers, and what method the current method was invoked from. Well if you’re using V8 (Chrome, Node.js) you can employ the following.
JavaScript developers who have spent time in languages like C often miss the ability
Share
The above will log
19.Combined with
arguments.callee.calleryou can get closer to the type of useful logging you get in C via macros.