Hashtags: #jsconf #debugging
All great, but more for analysis than straight debugging
There's so much here, it gets its own section!
console.logRead the spec, read JS: TDG, go beyond the good parts
Read up on ES5, ES6, ES7
Subscribe to JS Weekly
Inconsistently written code SUCKS to debug
Look into things like Idiomatic for a starting point, and EditorConfig to help enforce it
You don't write code for yourself, you write it for the moron who has to maintain it in a year.
More often than not, you are that moron.
Not just for hiding things
For when Private Mode isn't enough
Named functions are easier to debug, as the call stack has a nice, clean name right there in it!
Combining $_ and $0 for fun and profit*
* There may not be profit
Use and abuse of conditional breakpoints
Just about everything is mutable, so make changes
SomeNative.prototype.someMethod = function () { debugger; }
Example, sorta
toWrap[method] = function wrapped () {
var groupName = identifier + ': ' + method;
console[grouping](groupName);
console.log('%s args: %o', method, arguments);
try {
var value = oldMethod.apply(this, arguments);
console.log('%s return value: %o', method, value);
return value;
} catch (e) {
console.error('%s error: %o', method, e);
} finally {
console.log('%s: Exiting', method);
console.groupEnd(groupName);
}
};
https://gist.github.com/brianarn/8951284