js 查看对象的属性特征

时间:2021-07-02 16:01:40   收藏:0   阅读:0

 

 

var user = {
    name:"angdh",
    age:11,

};

console.log(
    JSON.stringify(Object.getOwnPropertyDescriptors(user),null,2)
);

 

{
  "name": {
    "value": "angdh",
    "writable": true,
    "enumerable": true,
    "configurable": true
  },
  "age": {
    "value": 11,
    "writable": true,
    "enumerable": true,
    "configurable": true
  }
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!