Some JS basic knowledge review notes

Source: Internet
Author: User

1. var a=123 b=++a//b=124,a=124

var a=123 b=a++//b=123,a=124

+ + priority problem, the execution order is different;

2, uninitialized variable value is Undefined,var A;alert (a)//undefined;

JavaScript will automatically give you an uninitialized variable set to undefined;

3, five basic types: typeof (digital type)//number;

typeof (String)//string;

typeof (bool type)//boolean;

typeof (undefined)//undefined;

typeof (null)//object;

4, str= "020";     parseint (str); 16;0 will be treated as octal;

If you do not want to be treated as octal to handle =>parseint (str, 10); 20;10 on behalf of decimal;

5. Exponential notation:

1E1 = = 1e1 = = 1e+1 = 1E+1//10;e equivalent to 10,e+1 equivalent to e1;e+3 equivalent to E3;

Tip: The maximum value JS can handle is 1.7976931348623157E + 308

The minimum value is 5E-324

Values outside these two are displayed as infinity (no infinity); Infinity and any number operations are infinity;

Minimum use-infinity

Maximum Use Infinity

6, Nan is a numeric value; typeof (Nan)//number;nan can be understood as a set, contagious, with a Nan in the operation, and all the equations as Nan;

7. Some operations of implicit type conversion

var a = "2", B = "3", C = 1;

A*b//6; (number);

A+b//"at"; (string);

A*c//2; (number);

Some numbers are converted to number, which can be used in the form of * *, but it is recommended to use parseint ();

Some JS basic knowledge review notes

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.