News for hackers. Stuff that matters.
Re:JavaScript debugging for beginners by mvclark on Monday May 19, 2014 @06:50PM (#7770247)
Nice post. Another one I find useful is to define your own log function, e.g.,

function log(x) {console.log(x);};

You'd use log instead of console.log for debugging your code. Then, to turn off logging, you set

function log(x) {};

or have a boolean switch in log function to do a similar thing. You could even use this approach to define debug levels to enable/disable.

There are no comments on this comment yet.