JS Basic Concept

Source: Internet
Author: User

  1. As long as the variable that is intended to hold the object does not actually hold the object, you should let the variable hold a null value.
  2. Conversion rules for number () functions
    1. If NULL, returns 0;
    2. If it is undefined, return nan;
    3. If it is a string, convert the numeric form string. The string is empty, converted to 0, and the other converted to Nan;
    4. If it is an object, call the object's valueof () and then follow the 3 conversion. If you convert to Nan, you call ToString (), and then you convert by 3.
  3. parseint ()
    1. Ignores the spaces in front of the string, and finds the first non-whitespace character straight.
    2. If the first character is not a numeric character or minus sign, parseint () returns Nan;
    3. parseint () converts a null character to return Nan, (number () returns 0 for null characters)
    4. parseint () resolves until a non-numeric character is encountered.
  4. Parsefloat ()
    1. Parsefloat () begins parsing from the first character (position 0) until an invalid floating-point numeric character is encountered (the first decimal point is valid, the second is not valid), or the last.
  5. Convert to String
    1. Values, Boolean values, objects, and string values have ToString (). But null and undefined do not have this method
  6. Equality operators
    1. Null==undefined will return true because they are similar values. However, null===undefined returns false because they are different types of values.
  7. for-in statements
    1. The for-in loop displays all the properties of the Window object in the BOM, and each execution loop assigns a property name that exists in the Window object to the variable propname.
    2. If the value of the variable representing the object being iterated is null or the undefined,for-in throws an error, then the loop body is corrected to not execute.
    3. The order of the property names that are output through the for-in loop is not predictable, but the properties are returned once.
  8. If two functions with the same name are defined, then the name belongs only to the post-defined function

JS Basic Concept

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.