let sy = Symbol("key1111");
let sy2 = Symbol("key2222");
let obj = {}
obj.name = "name"
obj['code'] = 'code'
obj[sy] = "sy1"
obj[sy2] = "sy22"
console.log(Object.keys(obj))
console.log(Object.getOwnPropertySymbols(obj))
console.log(Reflect.ownKeys(obj))
以上输出分别为
[“name”, “code”, “addr”]
[Symbol(key1111), Symbol(key2222)]
[“name”, “code”, “addr”, Symbol(key1111), Symbol(key2222)]