프로퍼티(Properties)
Use dot notation when accessing properties.
프로퍼티에 억세스하는 경우는 점
.을 사용해 주십시오.const luke = { jedi: true, age: 28, }; // bad const isJedi = luke['jedi']; // good const isJedi = luke.jedi;
Use subscript notation
[]when accessing properties with a variable.변수를 사용해 프로퍼티에 억세스하는 경우는 대괄호
[]를 사용해 주십시오.const luke = { jedi: true, age: 28, }; function getProp(prop) { return luke[prop]; } const isJedi = getProp('jedi');
'개발 > Javascript' 카테고리의 다른 글
| 코멘트(Comments) (0) | 2018.03.11 |
|---|---|
| 블록(Blocks) (0) | 2018.03.11 |
| Arrow함수(Arrow Functions) (0) | 2018.03.11 |
| 조건식과 등가식(Comparison Operators & Equality) (0) | 2018.03.11 |
| Hoisting (0) | 2018.03.11 |