JavaScript Advanced Programming-the sixth chapter of object-oriented programming

Source: Internet
Author: User

Create two main forms of an object, create an object instance, and create objects literal

Object contains properties and methods

Data

, attributes have four attributes that describe the behavior of the property, and they are:

Whether the configurable (configurable) can be deleted or modified to be accessor properties

Whether the Enumerable (enumeration) can be for-in

Writeable (writable) ability to modify property values

Value (value) defaults to undefined, reading data from this location or saving the new value to this location

eg

var person = {} ';

Object.defineproperty (person, "name", {writeable:false,value: "fff"});//person.name becomes read-only.

However, it is important to note that the Configurable:false attribute in Object.defineproperty () is not configurable, and cannot be used except for the writeable, and cannot be passed: True to change back,

JavaScript Advanced Programming-the sixth chapter of object-oriented programming

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.