zoukankan      html  css  js  c++  java
  • 第6章 面向对象的程序设计(待完善)

    属性类型:

        数据属性--4大行为:[[Configurable]]

                  [[Enumerable]]

                  [[Writable]]

                  [[Value]]

             修改方法 obj.defineProperty(obj,"name",{

                  Configurable:false,

                  ....

                 })

        访问器属性--4大特性:[[Configurable]]

                   [[Enumerable]]

                   [[Get]]

                   [[Set]]

              

              定义方法 obj.defineProperty(obj,"name",{

                  Configurable:false,

                  ....

                 })

    定义多个属性:

    object.defineProperties(book,{

      _year:{

        value:2004

      },

      

      _edition:{

        value:1

      },

      

      year:{

        get:function(){

          return this._year;

        },

        set:function(newValue){

          if(newValue>2004){

            this._year = newValue;

            this._edition =+ newValue - 2004;

          }

        }

      },

    })

    读取属性的特性

      Object.getOwnPropertyDescriptor()

  • 相关阅读:
    网店系统H5版(一)
    php date()方法传入时间戳为空时返回1970-01-01
    MySQL实用语句
    HTTPS和SSL握手过程(转载)
    jinfo
    linux下以‘-’开头的文件名
    ssh连接服务器失败解决记录
    Linux时区详解
    fiddler抓包url有乱码
    mysql灾备演练问题
  • 原文地址:https://www.cnblogs.com/alex-web/p/5000583.html
Copyright © 2011-2022 走看看