5 debug skills necessary for JavaScript programmers
Author: brush fire pan
link: I have always used debugger, in general, it is the ratio More smoothly, but sometimes you will find that there is a need for better ways. The following JavaScript techniques believe you will find it very useful:
1. debugger;
I have said before that you can add a sentence of debugger in JavaScript code to create a breakpoint effect manually.
do you need a conditional breakpoint? You only need to encircle it with a if statement:
[code]if (somethingHappens) {
debugger;
2. is set to trigger breakpoints
Google browser's development tool has a super easy function to deal with this situation, called "Break on...". You can see the menu item on the DOM node by right clicking. The trigger condition of
breakpoint can be set to delete the node, change the property of the node, or change its sub node.
3. Ajax breakpoints,
XHR breakpoints, or Ajax breakpoints, like their names, allow us to set a breakpoint that triggers them when the characteristic Ajax calls occur.
when you debug the network transmission of Web application, this method is very effective. The
4. mobile device simulation environment
there are some very interesting analog mobile devices in Google browsers to help us debug the running of the program in the mobile device.
find it: press F12, deploy the developer tool, and then press the ESC key (the current tab is not Console), you will see the second layer debug window appear, and there are various analog devices in the Emulation tag page inside.
of course, this does not become a real iPhone, it only simulates the size of iPhone, touch events and browser User Agent value.
5. uses Audits to improve your website
YSlow is a great tool. Google browser's developer tool also has a very similar tool called Audits.
it can quickly audit your website, and provide you with very practical and effective suggestions and methods to optimize your website.
Author: headline / Web all stack develop
link: http://toutiao.com/a6272476035301310721/
source: headline (today's headline creation platform)
copyright to the author all. For commercial retransmission, please contact the author for authorization.