"JS Review Notes" 01 Basic grammar

Source: Internet
Author: User
Tags control characters try catch

Digital:

    • JS has only one numeric type, which is equivalent to double. (I do not know why, every time I hit a double input method will appear to tease than three words)
    • Nan is a numeric value that can be used to detect Nan with isNaN (number)
    • Infinity represents all values that are greater than a very large value
    • JS has an object, math, which contains a set of methods that act on numbers.

String:

    • All characters in JS are Unicode, 16-bit
    • JS has no character type, just create a string containing only one character.
    • Backslashes, quotes, and control characters can be inserted into a string using escape characters, such as "A" = = = "\u0041"
    • The string has a length property to represent the string, "Troy". Length is 5,touppercase () is uppercase

Statement:

    • Unlike many other languages, JS's code does not create new scopes, so variables should be defined in the head of the function, not in the code block. So the recommendation is to place the function at the beginning of the functions like the C language.
    • Conditional judgments are listed as false values: false,null,undefined, empty string ' ', number 0, number Nan, and all other values are true, including true, "false"
    • There are two types of loop statements, one for the normal for loop, and one for the in statement, which enumerates all the property names of an object. Remember is the property name Oh, not the property value, not the Property object.
    • You can use the Obj.hasownproperty ("name") method to determine if obj has an object of this property.
    • The throw of a try catch statement can throw any object, and the object we catch usually has a name and a message two properties
    • Return can return any value, if not return value, default is undefined.

Type:

    • Using typeof to get the type, a total of the following are returned: ' Number ', ' String ', ' Boolean ', ' undefined ', ' function ', ' object '. Returns ' object ' even if it is null or an array

"JS Review Notes" 01 Basic grammar

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.