JavaScript Debugging Methods

Source: Internet
Author: User

for Beginners, the code effect and expected non-conformance , is a very tired thing, because do not know how to check. find someone else, do not know, do not understand who to find, around the people have no knowledge of the front end, very painful, if there is any pain in the front of the learning, then this even a. Remember before, I was just beginning to write a novice, learning to write code, and then, after the end, a test, found errors, how to do, heart tired,can only go back to freeze screen, one row row wrong, fortunately someone has code to show, otherwise, really do not know how to do. until very later, after so many mistakes, (of course, for many people, I am still a novice) I summarize the way I personally write code debugging. not many, but for beginners, enough. This is an error code, (not written below), just to do the sample, there are too many errors. Chrome browser is used. Sublime Editor.
<! DOCTYPE html>


Using Chrome to open this code, the effect is as follows.

Debugging method:

1:no matter what the code does, however, there are no errors, you just have to press F12 to know.

Then, we found that there is a red error! What is the English here?! Do not know, how to do, then I can not use this method? No, of course not!
These two places are the entrances that can be ordered. After entering, discover the new world.


Then, you find your source code, well, that's it.The yellow highlighting area is your fault. Then you can change the code. After that, the process is repeated.2:Debuggeradded a sentence of debugger in any place;Back to the browser,Press F5 to refresh the key. After that, the browser layout is tuned to this. The boundaries of these four areas areYou can manually adjust the. Direct view: Zone 1: Real-time effects Zone 2: Source code Zone 3: reported errors Zone 4: Variables run to debugger; After this sentence, the engine will stop moving forward, this time, you can press the two to go forward in Zone 4, or press F10/F11.The real-time values of these variables are also shown in zone 4. /F10 on the left: the function is skipped. /f11 on the right: step-by-step execution.
In this way, you can determine whether the values you expect are the same, and then Debug.

JavaScript Debugging Methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.