5 debug skills necessary for JavaScript programmers

time:16-04-17 forum:HTML web page, JS language and code
  http://toutiao.com/a6272476035301310721/

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.

prev:Nine year old American boy recommended h... next:Thousands of Taijiquan invite you to joi...
post comment
Notice



approved   Reminder: handle the delivery proced...   Extreme sports - dogs can do it   Imagination map: only can not do, di...   Ji'nan's four largest paediatric ped...   Many people in Ji'nan fall in love w...
rand   Common JavaScript regular expression...   JS let your title bar   Automatically add copyright informat...   Scroll code   DIV design of the cat source code
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com