Js authoritative guide --- Study Notes 01, js --- Study Notes 01

Source: Internet
Author: User

Js authoritative guide --- Study Notes 01, js --- Study Notes 01

1. When a function is assigned an attribute to an object, it is changed to a method;
2. If division by Zero is not reported, only Infinity or negative Infinity is returned. Exception: dividing by zero equals to non-Numeric (NaN ).
3. NaN is not equal to any value!
4. Javascript uses a binary floating point representation (IEEE-754), which will lead to the inability to accurately represent simple decimal places like 0.1;
It can only represent any combination of sums of 1/(2 ^ N.
5. boolean values: true and false values;
False: false, null, 0,-0, "" (empty string), NaN, undefined
True Value: All values except the dummy value!
6. Original values: undefined, null, number, string, and Boolean.
-- Unchangeable
7. Any value except null and undefined has the toString () method;
It can be converted to a String using the String () method: String (undefined) // => undefined
8. Value of the number type. When toString () is called, you can specify a parameter to indicate the Conversion Type: 2, 8, 16;

Var n = 1;

Var s2 = n. toString (2 );

Var s8 = "0" + n. toString (8 );

Var s16 = "0x" + n. toString (16 );

9. toFixed (number) method: Rounding the form, retaining the number of decimal places;
10. Several Methods for converting strings to numbers: Number (), parseInt ()/parseFloat (), string-0
1) Number () method: If the string is not a Number, NaN is returned.
2) parseInt () and parseFloat () Methods: parses numeric characters in sequence. If a non-character is encountered, resolution is aborted. If the first character of a string is not a number, NaN is returned;
3) parseInt () can accept the second parameter, that is, the hexadecimal conversion (2 ~ 36)

Related Article

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.