The notes of the JavaScript language essence

Source: Internet
Author: User

0. JavaScript's simple data types include numbers, character A, Boolean values (True/false), NULL, and undefined values, and other values are objects.

1. JavaScript has only one numeric type, which is represented internally as a 64-bit floating-point number. No integers are separated, so the values of 1 and 1.0 are the same.

2, Nan is a numeric value that represents a result of an operation that does not produce a normal result. Nan is not equal to any value, including itself. You can use the function isNaN (number) to detect Nan, but it is recommended to use Isfinite () to detect whether a value is a number.

    • typeof NaN = = = ' Number '//true
    • Nan = = = Nan//false
    • Nan!== nan//true
    • IsNaN (0) IsNaN (' 0′)//false
    • IsNaN (NaN) IsNaN (' oops ')//true

3. JavaScript has no character type. To represent a character, you simply create a string that contains only one character, and once created, it is immutable. When created, Unicode is a 16-bit character set, so all characters in JavaScript are 16-bit.

4, False, null, undefined, empty string, 0, Nan are all considered false. Other values are true, including ' false ', and the new Boolean (false).

5. The values generated by the TypeOf operator are: ' Number ', ' String ', ' Boolean ', ' undefined ', ' function ', ' object '. Returns ' object ' for arrays or null,typeof.

6. If the first operand is a false,&& returns the value of the first operand, and vice versa, returns the second; if the first operand is true, | | Returns the value of the first operand, and vice versa, returns a second;

7. Arguments has a length property, but not an array, and it does not have any array of methods.

8. Methods for handling the regular: Regexp.exec (), Regexp.test (), String.match (), String.Replace (), String.search (), and String.Split () " See also: JavaScript regular expression "

9, the regular expression factor: \/[] () {}?  +  *   |  . ^ $. To match a factor, escape with \ In the literal, and double-write \ In the RegExp object. Note \ Prefixes do not make letters or numbers literal.

10. Grouping of regular expressions

    • Capture type: A captured grouping is a branch of a regular expression enclosed in parentheses. Any characters that match this grouping will be captured. Each captured group is assigned a number. 1 is the first capturing group, 2 is the second one, and so on.
    • Non-capturing type: Non-capturing group band?: prefix. It only makes a simple match, does not capture matching text, and does not interfere with the numbering of the capturing type grouping
    • Forward positive match: with a = prefix, similar to a non-capturing grouping, but after this group match, the text will fall back to where it started, and it doesn't actually match anything.
    • Forward negative match: Band?! Prefix, similar to a forward positive match, but it continues to match only if it fails to match

11. Interesting examples of = =

    • ' = = ' 0 '//false
    • 0 = = "//false"
    • 0 = = ' 0 '//true
    • False = = ' false '//false
    • false = = ' 0′//true
    • false = = undefined//false
    • false = = NULL//false
    • Null = = undefined//true
    • ' \t\r\n ' = = 0//true

Original: http://www.ido321.com/1412.html

JavaScript language Essence 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.