1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Object.prototype.d = 'ddd' let obj = new Object({ a: 'a1', b: 'b2', c: 'c3' }) Object.defineProperty(obj,'e',{ value: 'eeee', enumerable: false })
console.log(Object.keys(obj))
console.log(Object.getOwnPropertyNames(obj))
let arr = [] for(let i in obj){ arr.push(i) } console.log(arr)
console.log(Object.values(obj)) console.log(Object.entries(obj))
|