JS Advanced Tutorial 3rd Edition notes (my understanding) has been updated in succession

Source: Internet
Author: User
Tags null null

JS Basics
Grammar
' Use strict ' (strict mode)
Defining variables
var object; Declare unassigned only, default value is undefined;
var object1= value; Declare and assign value;
function Fun (a) {This is also called a local variable
var obj=[] This is called a local variable and cannot be called in the outer body of the function
Objct1=[] is called a global variable, which can be used when the function name is called once.
}
Multi-variable definition
var a,b,cx=1,2,3;
Data type
Number,string,undefined,null,bollean (Basic)
Type syntax description
typeof typeof Expression type
The null NULL pointer returns the type of object if the variable that is defined in the future needs to be saved, then use the variable null, by NULL to check whether the corresponding variable holds an object reference (not a real object)
Undefined the corresponding value is derived from the null value
The value of number number (object) floating point takes up twice times the integer value, and if there is no value or 0 after the decimal point, it is implicitly converted to an integer type.
Range of values
Number.min_value Minimum value
Number.MAX_VALUE Maximum Value
Infinity Positive and negative infinity (function: isfinite (obj) is used to detect whether this value is between the minimum or maximum, and returns true if the condition is set)
Infinity:Number.NEGATIVE_INFINITY and number.positive_infinity can get
Nan: Non-numeric, any operation involving Nan, returning the result or Nan,nan never equal to Nan IsNaN (obj) to determine if it is a numeric value, and returns False if it is a numeric value
numeric conversions
Number ()
If it is Boolean true and False returns the corresponding 1 and 0
If it is a value, it is passed in and out
If it is null, it returns 0
If it's undefined, return nan.
String
If a value in the string is converted to decimal, then the corresponding operation
If it is a floating-point type, convert the corresponding floating-point format
In the case of octal, hexadecimal, it is converted to the corresponding decimal
If it's empty, it's converted to 0.
Returns Nan If the above conditions are not met
If it is an object, you can use the valueof () method, and then convert it according to the rules above, and if you convert to Nan, call ToString ()
method, and then convert as above
parseint (Obj,byte)
If the first found is not a numeric string, the value of the object is returned, if the first character is not a numeric value or a minus sign, returns Nan
BYTE indicates the corresponding binary number, the default decimal
parsefloat (obj)
String
Features: Stitching
A=a+b or A+=b
How to convert into characters
. ToString () {null and undefined yes No}
. ToString () can not pass parameters, if a parameter is entered, only the cardinality of the numeric value is entered, by default in decimal or octal, 16 binary, etc.
. ToString () the corresponding rule
If no arguments are returned, the corresponding result
If the value is NULL, return "NULL"
If undefined, returns "undefined"
Object
Grammar
var obj=new Object ();
Properties and Methods
Constructor: Saves the constructor body of the currently created object
hasOwnProperty (PropertyName): Checks whether an instance object for the current property exists (non-instance prototype)
isPrototypeOf (object): Checks whether the incoming object is a prototype of the current object
propertyIsEnumerable (PropertyName) checks if the corresponding property is capable of for-in statements and must be used in string mode
toLocaleString () returns the string representation
ToString () ibid.
ValueOf () returns the corresponding string, value, Boolean, same as ToString ()
Operator
Unary operator
++ --
If the calculation is simple, then the calculation is simple, but if the mixed calculation, then the method will be
+ + in front, returns the new value; + + in the back, return the old value
Description
Unary operators operate in the same way as strings, and the shaping operation is similar



JS Advanced Tutorial 3rd Edition notes (my understanding) has been updated in succession

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.