1 obj = {} 2 3 window[a] // a is not defined 4 obj[b] // b is not defined 5 obj[a] // a is not defined 6 7 window.a = 'dpc' 8 obj.b = 'dpc' 9 10 window[a] // undefined 11 obj[b] // b is not defined 12 obj[a] // undefined 13 14 但obj['a']访问不到值 15 16 window['a'] // dpc 17 obj['a'] // undefined
疑窦:
window.a 与 window[a] 有什么含义怎么用什么时候可以互换
11 obj[b] // b is not defined 为什么
12 obj[a] // undefined 获得已定义变量为啥obj['a']取不到值