JavaScript error type ———— Quack No. second

Source: Internet
Author: User

1.SyntaxError (Syntax error)

Syntax error occurred while parsing the code

Eg:var 1a;

uncaught syntaxerror:unexpected Number

2.ReferenceError (reference error)

A. Referencing a non-existent variable

Eg:console.log (a);

Uncaught referenceerror:a is not defined

B. Assigning a variable to an object that cannot be assigned a value

Eg:console.log () = 1;

Uncaught referenceerror:invalid left-hand side in assignment

3.RangeError (range error)

Out of valid range

Eg:var a= New Array (-1);

Uncaught rangeerror:invalid Array length

4.TypeError (type error)

A. The variable or parameter is not the expected type, such as the use of the new command for values of primitive types such as strings, booleans, numeric values, and so on, because the parameters of the new command should be a constructor.

Eg:var a= New 123;

Uncaught typeerror:123 is not a function

B. Methods for calling objects that do not exist

Eg:var A;a.aa ();

Uncaught typeerror:cannot Read property ' AA ' of undefined

  

5.URLError (URL error)

The URL-related function parameters are incorrect, mainly the six functions of encodeURI (), decodeURI (), encodeURIComponent (), decodeURIComponent (), Escape (), and unescape ().

Eg:decodeuri ('%2 ')

Uncaught Urierror:uri Malformed

6.EvalError (eval error)

The eval function was not executed correctly

Original link: https://www.cnblogs.com/yanze/p/5997489.html

JavaScript error type ———— Quack No. second

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.