Getting Started with JavaScript (ii)

Source: Internet
Author: User
Tags bitwise bitwise operators

The increment and decrement operators apply to any value, and the difference between the predecessor and the post is the same as the difference in C language

All values are stored in the IEEE-754 64-bit format, and the bitwise operators do not directly manipulate the 64-bit values. Instead, the 64-bit value is converted to a 32-bit integer, and then the result is converted back to 64 bits, and when a bitwise operation is applied to a special NaN and Infinity value, both values are treated as

In the case where an operand is not a Boolean value, the logic and operation, as well as the logic or operation, do not necessarily return a Boolean value, both of which are short-circuiting and can take advantage of the logic or this behavior to avoid assigning null or undefined values to variables

Equality and inequality both operators convert the operands before comparing their equality, and NULL = = undefined returns true if the two operands are objects, then compare whether they are the same object

Congruent and non-congruent these two operators do not convert operands before comparison, it is recommended to use congruent and non-congruent operators

Flow control statements have an if statement, a do-while statement, a while statement, a for statement, a for-in statement, a label statement, a break statement, a continue statement, a switch statement

The function of the WITH statement is to set the scope of the code to a specific object, primarily to simplify the work of writing the same object multiple times, but it is not recommended to use

Functions are declared with the function keyword, followed by a set of parameters and the body of the function, without specifying whether or not to return a value, it is recommended that the function always return a value or never return a value, otherwise it will inconvenience debugging

This parameter array can be accessed by the arguments object in the body of the function, all parameters are passed the value

Functions do not implement overloading as in the traditional sense

A variable may contain values for two different data types, which refers to simple data segments, whereas reference type values are objects stored in memory, can be added to properties and methods, and properties and methods can be changed and deleted

When a value of a reference type is copied from one variable to another, two variables actually refer to the same object

With the instanceof operator, if the variable is an instance of a given reference type, it returns true

The execution environment defines other data that a variable or function has access to, and each execution environment has a variable object associated with it, and all variables and functions defined in the environment are stored in the object, although the code we write cannot access the object, but the parser uses it in the background when it processes the data.

The global execution environment is considered a Window object, and the internal environment can access all external environments through the scope chain, but the external environment cannot access any variables and functions in the internal environment, and variables declared with Var are automatically added to the closest environment

JavaScript does not have block-level scopes

The best way to optimize memory consumption is to save only the necessary data for the code in execution, and once the data is no longer useful, it is best to release its reference by setting its value to null

Object is an instance of a particular reference type, and the new object is created with a constructor

Creating an object instance can also be used to simplify the process of creating an object containing a large number of properties, which is also preferred by the developer to pass a large number of optional parameters to the function.

The main advantage of using square bracket notation to access the properties of an object is that the property can be accessed through a variable

Each item of an array can hold any type of data, the length property of the array is not read-only, and by setting this property you can remove an item from the end of the array or add a new item to the array

The Array.isarray () method eventually determines whether a value is an array, the array has the Stack method push () and pop (), the queue method Shift () and unshift (), the Reorder Method sort () and reverse (), and concat (), Slice (), splice (), IndexOf (), LastIndexOf () method

The iterative method of the array is every (), filter (), ForEach (), map (), some (), and the merge method has reduce (), reduceright ()

Getting Started with JavaScript (ii)

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.