Poor man's JavaScript debugger

// Hold the trace data var trace = String(); // Debug log method function debug(str) { if(trace.length > 0) trace += "\n-> "; trace += str; } // The function with errors function advancedFunction() { try { debug("advancedFunction()"); debug("doing this"); doThis(); debug("doing that"); doThat(); debug("doing other"); doOther(); } catch(ex) { debug(ex.message); alert(trace); } }

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints