JavaScript Learning Notes

Source: Internet
Author: User

Grammar:

Case-sensitive for defining variables

Strict mode: ES5 introduce ' use strict ', in strict mode will appear in the non-strict mode through the program appeared bug

Variable: Define the variable keyword: var, note that you must initialize the variable when it is defined, otherwise the variable will save undefined.

Data type

TypeOf: An operator that detects the data type of a given variable

Undefined: Undefined (initialize when defining variables, deposit to Undefined)

Null:null represents an empty object pointer that returns an object using typeof detection, which means that NULL is a

Boolean: There are two values of True&false

Number:

can represent integers and floating-point values. If more than JS can be represented by the range of values, then return +-infinity (positive and negative infinity), determine whether a number is infinity through isfinite ();

NaN: Non-numeric. All operations that involve Nan are returned as Nan. The second is Nan with any value that includes Nan. IsNaN () determines if the accepted parameter is ' not a number ', and the function attempts to convert the value to a number.

Numeric conversions:

Number () parseint () parsefloat ()

parseint ("") <->nan Number ("") <->0

parseint () can provide a second parameter, which is converted by how many binary

String:

Convert to String:

The ToString () method returns a copy of the string, null and undefinded without this method. The ToString () method that calls the value to add the parameter, the parameter indicates how many binary parsing

The string () method can convert any type of value to a string, but there are rules

* There is ToString () to invoke (no parameter) method

* NULL returns NULL

* Undefinde return Undefinde

Object: Use the new operator to create objects consistent with Java.

Each instance has a method:

Constructor (): Saves the function used to create the current object

hasOwnProperty (PropertyName): Checks whether the current given property exists in the current object instance and not in the prototype.

Ispropertyof (object): Checks if the incoming object is a prototype of the current object

propertyIsEnumerable (PropertyName): Checks whether a given property can be enumerated by for-in, and the argument is in string form

Tolocalstring (): Returns the object with a string representation, according to the environmental area problem

ValueOf (): Returns the object string representation

ToString (): Returns the object string representation

Statement:

For in is the property name of the traversed object, traversing the array when the element subscript for is the element that iterates through the collection itself, and iterates through the elements in the contents of the province (ES6 new) With statement: Sets the scope of the code in a specific object function: function declaration function ES functions do not mind how many arguments are passed, nor do they care what type of arguments to pass in. The reason is that the parameters of ES are internally represented by an array, and the function receives the array as always, and does not care about the specific parameters contained in the function body can use the arguments object to access the array, which is an array of classes object. Arguments values are always synchronized with the corresponding named parameter values there is no overload in Es, and two identically named functions execute only after the defined function.

JavaScript Learning Notes

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.