企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
* [12.1](https://github.com/yuche/javascript#12.1) 使用 `.` 来访问对象的属性。 ~~~ const luke = { jedi: true, age: 28, }; // bad const isJedi = luke['jedi']; // good const isJedi = luke.jedi; ~~~ * [12.2](https://github.com/yuche/javascript#12.2) 当通过变量访问属性时使用中括号 `[]`。 ~~~ const luke = { jedi: true, age: 28, }; function getProp(prop) { return luke[prop]; } const isJedi = getProp('jedi'); ~~~