JavaScript debugging for beginners
juliepagano.com
juliepagano.com
"If you click the braces at the bottom of the developer tools, they will “pretty print” the code. It makes it a little bit more readable, but it’s still difficult to decipher.
(granted, javascript consoles were a bit different back then: http://notetodogself.blogspot.com/2008/08/debug-javascript-i...)
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.
However, on Mac OSX, Ctrl+Shift+I makes more sense because the default for F12 is to adjust sound volume up. You have to press Fn+F12 which is more awkward than Ctrl+Shift+I. (Or Cmd+Alt+I in Safari).