3 ms·
Devtools Console, from Novice to Ninja
- msoad 13y agoMy two cents: ⌘ + K => clears console inspect(element) => inspects element $(query) => equal to document.querySelector $$(query) => equal to document.querySelectorAll $_ => last output clear() => clears the console. in your code your can `console.clear()` console.count(label) => counts with a label that you pass console.log("%cThis will be formatted with large, blue text", "color: blue; font-size: x-large"); a lot more info here: https://developers.google.com/chrome-developer-tools/docs/console https://developers.google.com/chrome-developer-tools/docs/co...
- minikomi 13y agoFormatting log output - fantastic! I really like to use: $0 -> $9 last hilighted elements in the inspector view Especially when dealing with d3 generated svg .. can be tricky to get the right element otherwise. Also, you can still use the debugger; command to stop the context within a function (eg, callback from ajax request), from within the console.
- quim005 13y agoSaw "ninja"; didn't read.
- izolate 13y agoNice one, I learned a lot from this article. Looking forward to trying out console.group() and console.assert() for tests.
- skeoh 13y agoOne consideration with console.assert() is that it does not interrupt execution as you might expect it to.