JavaScript Learning Abstracts (2)

Source: Internet
Author: User
Tags inheritance

The debugger statement does not start the debugger. However, if the debugger is already running, this statement will actually produce a breakpoint.

For example, if you use the Firefox debug extension Firebug, you must first enable Firebug for the Web page you want to debug so that the debugger statement works correctly.

The difference between strict and non-rigorous mode:

1. Prohibit the use of with statements in strict mode

2. In strict mode, all variables are declared, and a reference error exception is thrown if an undeclared variable, function, function argument, catch clause, or global object property is copied. In a non strict mode, this implicitly-declared global variable is a new addition to the global object.

3. In strict mode, a this value in the called function (not the method) is undefined. In a non-strict mode, the this value in the called function is always the global object.

4. In a non strict mode, null and undefined values are replaced by global objects and by objects that are not object-valued. In strict mode, when a function is invoked through call () and apply (), the This value is the first parameter passed in by called () or apply ().

5. In strict mode, assigning a value to a read-only property and creating a new member for an object that is not extensible will throw a type error exception. Not strictly, these operations are simply failure to operate, no error.

6. In strict mode, code that passes in the eval () cannot declare variables or define functions in the context in which the calling program resides, but not strictly.

7. In strict mode, the arguments object of a function has a static copy of the Passed-in function value. In a arguments model, the object has a magical behavior, and the array elements and function arguments in arguments are references to the same value.

8. In strict mode, when the delete operator follows an illegal identifier (such as a variable, function, function argument), a syntax error exception is thrown. In non strict, do nothing, return false.

9. Under strict conditions, it is not allowed to octal integer direct quantities (prefixed by 0, rather than 0x), and some implementations are not strictly permitted.

For (Var in object) statement traverse an object's properties

Functon name ([param[],...]) {body} declares a function

throw throw expression; Throw an exception

Try try{statements} catch exception

"Use strict" applies strict patterns to scripts and functions

With (object) statement extended scope chain (not supported)

object is the basic data type of JavaScript. An object is a compound value: it aggregates many values (raw values or other objects) together. You can access these values by name. Objects can also be viewed as unordered collections of attributes, each of which is a name/value pair. Property names are strings, so we can think of objects as mappings from string to value. There are many names for this basic data structure, some of which we are already familiar with, such as hash hash, hash hashtable, Dictionary dictionary, associative arrays associative array.

An object is not just a string to a value mapping, but a JavaScript object can inherit an attribute from an object called a prototype, in addition to maintaining its own properties. The method of an object is usually an inherited property. This archetypal inheritance Prototypal inheritance is the core feature of JavaScript.

JavaScript objects are dynamic, can be new or deleted, but they are often used to simulate structural bodies (struct) in static and statically typed languages. Sometimes they are also used as a collection of strings (ignoring values in a name/value pair).

Values in JavaScript are objects except strings, numbers, true false null undefined.

Although strings, numbers, and Boolean values are not objects, their behavior is very similar to immutable objects

If the variable x is a reference to an object, then the Execute code VAR y=x variable y is also a reference to the same object, not a copy of the object. Modifying this object with the variable y also affects the variable x.

The most common use of objects is creating the Create settings set find query Delete Delete detection Test enumeration enumerate its properties.

Properties include names and values.

An attribute name can be any string that contains an empty string, but two properties with the same name cannot exist in the object. The value can be any JavaScript value, either a getter or setter or both.

In addition to including attributes, each object has three object attributes

The object's prototype prototype to another object whose properties inherit from its prototype object.

The class class of an object is a string that identifies the type of object.

The extended tag extensible flag of the object indicates whether a new attribute can be added to the object.

One purpose of the Inherit () function is to prevent library functions from accidentally modifying objects that are not under your control.

. The following is a simple identifier named after the property name.

[] inside is an expression that evaluates to a string, which is the name of the attribute

If an object's property name is a reserved word, you must access them with [].

JavaScript objects are associative arrays.

In c C + + JAVA and strongly typed strong typed languages, objects can have only a fixed number of properties, and these attribute names must be defined well in advance.

Delete simply disconnects the property from the host object and does not manipulate the properties in the property.

Delete Book.author; Book no longer has attributes author








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.