The difference between the alert and Console.log () for JavaScript debugging

Source: Internet
Author: User
Tags object object
The usefulness of Console.log ()

It's mostly handy for your modal JavaScript, and you can see what you're outputting in the page.

His advantages compared to alert are:

He can see structured things, if it is alert, fade out an object is [Object Object], but the console can see the contents of the object.

Console does not interrupt the operation of your page, if you use alert to bounce out the content, then the page is dead, but the console output after your page can be normal operation.

The console is very informative and you can enter console in the console and you will see:

In addition, the use of alert debugging there is a big disadvantage or the pit dad, is debugging after forgetting to delete the alert () to remove or comment out the code to submit, the result is someone else visit this page inexplicable pop-up box ... This is a very bad habit, so when we do JavaScript debugging, try to use Console.log ().

The difference between the alert and Console.log () for JavaScript debugging

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.