ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
* [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'); ~~~