JS Advanced Programming 2nd part of the Knowledge points 1

Source: Internet
Author: User

Saving floating-point values requires twice times the memory space to hold the integer value, so ECMAScript will lose no chance to convert the floating-point value to an integer value
The highest precision for floating-point values is 17 decimal places
parseint string converted to numeric value, can be transmitted cardinality (8,16)
parsefloat Ibid.
Difference: parsefloat always ignores the leading 0, only the decimal value is parsed, and the 16 binary string is always converted to 0.

Post increment and decrement are important differences from pre-increment decrement: increment and decrement operations are performed after the statement that contains them is evaluated.

Example:

var num1=2;

var num3=num1--+num2;
alert (num3);//22
alert (NUM1);//1

Bitwise operators:

A 32-bit signed integer, the first 31 bits representing the value of the integer, and the 32nd bit for the symbol of the value: 0 for positive numbers and 1 for negative numbers. The bit that represents the symbol is called the sign bit, and the value of the symbol bit determines the format of the other bit values.

Steps for binary complement (negative numbers are stored in binary code):

1> the binary code of the absolute value;

2> binary Inverse Code, the 0 is replaced with 1, 1 is replaced by 0;

3> binary inverse code plus 1;

Bitwise NON ~ (not wavy): intrinsic-negative value of the operand minus 1.

Bitwise AND & (and): only two values correspond to a bit 1 o'clock to return 1, and any one is 0, and the result is 0.

Bitwise OR | (OR): One is 1 to return 1, only two bits are 0 o'clock to return 0.

Bitwise XOR or ^ (XOR): Two value corresponds to a bit only one 1 o'clock returns 1, if the corresponding two bits are 1 or 0, return 0.

Move left <<: move left does not affect the sign bit of the operand .

Signed right Shift >>: reserved sign bit (i.e. sign mark) start from second position

Unsigned right shift >>> positive results are the same as signed right shifts, and the unsigned bit right shift for negative numbers fills the empty space with zero, instead of filling the empty space with the value of the sign bit, as with the right shift of the symbol.

All parameters in the ECMAScript are passed as values, and arguments cannot be passed by reference.

JS Advanced Programming 2nd part of the Knowledge points 1

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.