November 2017
Intermediate to advanced
386 pages
9h 22m
English
Let's start with a common problem. When debugging code, you usually need to add some kind of logging information, to see if a function was called, with what arguments, and what it returned, and so on. (Yes, of course, you can simply use a debugger and set breakpoints, but bear with me for this example!) Working normally, that means that you'll have to modify the code of the function itself, both at entry and on exit. You'll have to code such as the following:
function someFunction(param1, param2, param3) { // do something // do something else // and a bit more, // and finally return some expression;}
to something like:
function someFunction(param1, param2, param3) { console.log("entering someFunction: ", param1, param2, param3);Read now
Unlock full access