JavaScript basics 1: JavaScript errors, javascript Basics

Source: Internet
Author: User

JavaScript basics 1: JavaScript errors, javascript Basics

Try statement test code block error.
Catch statement processing error.
Custom error in throw statement creation.

Errors will occur. When the JavaScript engine executes JavaScript code, various errors may occur: syntactic errors, usually code errors or typos caused by programmers. It may be a spelling error or a lack of functionality in the language (possibly due to browser differences), or an error may be caused by incorrect output from the server or user. Of course, it may also be caused by many other unpredictable factors. When an error occurs, when something goes wrong, the JavaScript engine usually stops and generates an error message. The technical term used to describe this situation is: JavaScript will throw an error. The try statement allows us to define the code block for Testing errors during execution. The catch statement allows us to define the code block to be executed when an error occurs in the try code block. The try and catch statements in JavaScript are paired.


The following is an example:


<! DOCTYPE html> 




Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.