Chrome developer console cheatsheetEdit
time('foo')
andtimeEnd('foo')
: print elapsed timekeys(window)
: shows current global variables (source)$_
: the value of the most recently evaluated expression$0
-$4
: recently selected DOM elements or JavaScript objects$(...)
: equivalent todocument.querySelector()
$$(...)
: equivalent todocument.querySelectorAll()
$x(...)
: get elements specified by XPath expressionclear()
: clear the console (also,Command-K
orControl-L
)copy(object)
: copy a string representation ofobject
to the clipboarddebug(fn)
: break into debugger whenfn
is calleddir(object)
: alias forconsole.dir()
(also, not that%0
can be used as a format specifier to inline thedir()
representation in the middle of aconsole.log()
)inspect(object)
: show an object in the "Elements" tabgetEventListeners(object)
: does what it says on the tinkeys(object)
andvalues(object)
monitorEvents(object[, events])
andunmonitorEvents(object[, events])
: logs events (eg.monitorEvents(window, "resize")
); note there are some aliases defined as well (eg. "mouse", "key", "touch", "control") that stand in for multiple underlying eventsprofile(name)
,profileEnd(name)
: start/stop a JavaScript profiling session