Chromeコンソールでオブジェクトの一部のプロパティが薄く表示されるのはなぜですか

ここに画像の説明を挿入します
淡い属性は、列挙できないことを意味します。非列挙性質が影響することに注意してくださいfor ... inObject.keys()JSON.stringify()結果などを!

function Person() {
    
    
    this.name = 'ifer';
}
Person.prototype.age = 18;

const p = new Person();

Object.defineProperty(p, 'sex', {
    
    
    value: 'man', // 内容
    writable: true, // 修改
    configurable: true, // 删除
    enumerable: false, // 枚举
});

console.log(p);

Object.getOwnPropertyDescriptor(p, 'name'); // 获取属性修饰符

おすすめ

転載: blog.csdn.net/dangpugui/article/details/114557423