Not all JavaScript objects are as easy as MyObject.property. Sometimes you may want to access a property whose key is stored in a variable. Luckily accessing these properties is very easy.
并非所有JavaScript对象都像MyObject.property一样容易。 有时您可能想访问其键存储在变量中的属性。 幸运的是,访问这些属性非常容易。
You may use array-style syntax to access an object's properties. The string within brackets returns the properties.
您可以使用数组样式的语法来访问对象的属性。 方括号中的字符串返回属性。
翻译自: https://davidwalsh.name/access-object-properties