Refer to colleagues’ technical sharing
1. $related
1. $0
View the currently selected node
element
Select a node in: View in
, indicating the currently selected node. You can also use it to view the last selected node; view the last selected node, which can be used untilconsole
$0
$1
$2
$4
2. $
and$$
If there is no $
defined as in the web page jquery
, $(选择器)
the first element that meets the conditions will be returned; $$(选择器)
all elements that meet the conditions will be returned
3、$_
$_ is a reference to the result of the last execution.
2. Console related
1、console.assert
The picture comes from MDN assert.
When the first parameter we pass in is false, console.assert prints the value that follows this parameter. if
You can know which variable has the problem without using judgment.
2、console.table
Elements can be converted into table form. Parameter one is the target element; parameter two is the attributes of the target element that need to be printed. If not passed, all attributes will be printed.
3、console.dir
Convert the target element to object output, so you can easily view the properties of the target element.
4. Console combined with await
3000ms
Then the results of asynchronous processing are printed directly.
5. Monitor execution time
console.time(name) starts the timer; console.timeEnd(name) ends the timer and prints the time it takes
3. Command menu
Command menu entry:
1. Topic switching
2. Add timestamp to logs
4. Others
1. Shadow debugging
2. Conditional breakpoint
Right-click on the breakpoint and edit the breakpoint to set the conditions under which the breakpoint will be executed.
3. queryObject(class)
Get all objects of a class
4. replay XHR requests (resend XHR requests)
When the request fails, you can directly right-click replay
and try again.