对象键值存储
输出是什么?
const obj = { 1: 'a', 2: 'b', 3: 'c' }
const set = new Set([1, 2, 3, 4, 5])
obj.hasOwnProperty('1')
obj.hasOwnProperty(1)
set.has('1')
set.has(1)
A:
false
true
false
true
B:
false
true
true
true
C:
true
true
false
true
D:
true
true
true
true
输出是什么?
const a = {}
const b = { key: 'b' }
const c = { key: 'c' }
a[b] = 123
a[c] = 456
console.log(a[b])
A:
123
B:
456
C:
undefined
D:
ReferenceError
最后更新于
这有帮助吗?