
๐ป ์๋ฐ์คํฌ๋ฆฝํธ์์ ๊ฐ์ฒด๋ ๊ฒ์ ์บ๋ฆญํฐ์ ๋น์ ํ ์ ์๋ค. ๋์ ์บ๋ฆญํฐ์ ๋ค๋ฅธ ์ฌ๋์ ์บ๋ฆญํฐ๋ ์ง์ ๊ณผ ๋ฅ๋ ฅ์ ๊ฐ์ง๊ณ ์์ง๋ง, ์๋ก ๋ค๋ฅธ ์ง์ ๊ณผ ๋ฅ๋ ฅ์ ๊ฐ์ง๊ณ ์๋ค. ํ์๊ฐ์ ์ ์ ๋ ฅํ๋ ์ ๋ณด๋ ๊ฐ์ ๋ค๋ฅด์ง๋ง, ์ ๋ ฅํด์ผ ํ๋ ์ ๋ณด์ ์ข ๋ฅ๋ ๋์ผํ๋ค.
property)์ ์ถ๊ฐ, ์ญ์ , ์กฐํ๋ฅผ ์์ ์์ฌ๋ก ํ ์ ์๋ค.dot notation๊ณผ bracket notation์ ์ฐจ์ด๋ฅผ ์ดํดํ๋ค.obj.a = "hello"์ ๊ฐ์ ์ด์ง์ ์ธ ๊ฐ์ฒด ํ ๋น ๋ฐฉ์์ ๋ฅ์ํ๊ฒ ๋ค๋ฃฐ ์ ์๋ค.delete ํค์๋๋ฅผ ์ฌ์ฉํ ์ ์๋ค.for๋ฌธ for ... in ๋ฌธ์ ๊ธฐ๋ณธ์ ์ดํดํ๊ณ ๋ค๋ฃฐ ์ ์๋ค.
let user = {
firstName: 'Steve';
lastName: 'Lee';
email: 'steve@codesates.com';
city: 'Seoul';
};
key-value pair)์ผ๋ก ์ด๋ฃจ์ด์ ธ ์๋ค.
let user = {
firstName: 'Steve';
lastName: 'Lee';
email: 'steve@codesates.com';
city: 'Seoul';
};
[๋ฐฉ๋ฒ 1] : Dot notation
user.firstName; // 'Steve'
user.city; // 'Seoul'
[๋ฐฉ๋ฒ 2] : Bracket notation
user['firstName']; // 'Steve'
user['city']; // 'Seoul'
Bracket notation์ ์ฌ์ฉํ ๋์๋ bracket ์์ชฝ์ ๋ด์ฉ์ ๋ฌธ์์ด ํ์์ผ๋ก ์ ๋ฌํด์ผ ํ๋ค.Dot/Bracket notation์ ์ด์ฉํด ๊ฐ์ ์ถ๊ฐํ ์๋ ์๋ค.
delete ํค์๋๋ฅผ ์ด์ฉํด ์์ฑ ์ญ์ ๊ฐ ๊ฐ๋ฅํ๋ค.
color ํค-๊ฐ ์์ด ์ญ์ ๋ ๋ชจ์ต์ด๋ค.in ์ฐ์ฐ์๋ฅผ ์ด์ฉํด ๊ฐ์ฒด ์์ ํด๋นํ๋ ํค๊ฐ ์๋์ง ํ์ธํ ์ ์๋ค.
name์ ํด๋นํ๋ ํค๋ ์กด์ฌํ๋ฏ๋ก true, color์ ํด๋นํ๋ ํค๋ ์์์ ์ญ์ ๋์๊ธฐ ๋๋ฌธ์ false๊ฐ ๋์ค๋ ๋ชจ์ต์ด๋ค.