Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bits and bobs from the presentation at http://www.83rdstasis.net/devtoolsecrets/slides/london-web/
console.log('Captain\'s Log 1', new Date());
console.info('Ammo supplies moderate');
console.debug('Shield\'s are up');
console.warn('Unidentified craft appearing');
console.error('Fire in the cargo bay');Run
console.assert(false, 'Not true'); // say 'Not True' only if 1st param === false
console.group('My group');
// …
// sub-groups are ok
console.groupEnd();
console.time('timerName');
// …
// sub timers are ok
console.timeEnd('timerName');
console.trace();
console.table(data);
console.table(data, ["col name 1", "col name 2"]);
$0 // current element selected
$1 // previous element selected (Chrome, Firebug, Opera, Opera Next, Safari)
$2, $3, $4 // history of previous elements selected (Chrome, Opera Next, Safari)
$_ // result of previous expression
monitorEvents(elem); // Monitor all events triggered on a particular DOM element.
unmonitorEvents(elem);
// Record new Timeline (frames, memory)
console.timeline("drawing pixels")
// …
console.timelineEnd("drawing pixels")
// Label the TimeLine
console.timeStamp("Adding resul")
// Record new JavaScript CPU profile
console.profile("drawing pixels")
// …
console.profileEnd("drawing pixels")
// Inspect object in Elements, Source or Profiles
inspect(document.body.firstChild) // Elements
inspect(someFunctionName) // Sources
// Copy object as a *string* to clipboard
copy($0)
copy(document.body)
// Query DOM elements from console
$$(someSelector) // = document.querySelectorAll(someSelector)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment