ํฐ์คํ ๋ฆฌ ๋ทฐ
728x90
// Set ์์ฑ
const set = new Set([2, 4, 6]);
console.log(set);
// Set ์ฌ์ด์ฆ
console.log(set.size);
// ์กด์ฌํ๋์ง ํ์ธ
console.log(set.has(2));
console.log(set.has(3));
// ์ํ
set.forEach((item) => console.log(item));
for (const value of set.values()) {
console.log(value);
}
// ์ถ๊ฐ
set.add(6);
console.log(set);
set.add(6);
console.log(set);
// ์ญ์
set.delete(6);
console.log(set);
// ์ ๋ถ ์ญ์
set.clear();
console.log(set);
// Object Set
const obj1 = { name: '๐', price: 3000 };
const obj2 = { name: '๐', price: 500 };
const objs = new Set([obj1, obj2]);
console.log(objs);
// ๋ฐฐ์ด -> Set
const animals = ['๐ถ', '๐ฑ', '๐ฆ'];
const setAnimals = new Set(animals);
console.log(setAnimals);
// Set -> ๋ฐฐ์ด
const arrayAnimals = [...setAnimals];
console.log(arrayAnimals);
728x90
'๐จ JavaScript > ๊ฐ์ฒด' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JavaScript] Object Destructing (0) | 2023.01.19 |
---|
๊ณต์ง์ฌํญ
์ต๊ทผ์ ์ฌ๋ผ์จ ๊ธ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
- Total
- Today
- Yesterday
๋งํฌ
TAG
- ์๋ฐ์คํฌ๋ฆฝํธ
- useState
- leetcode
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- DB
- ํจ์
- mdn
- git
- zustand
- ์๋ฌ
- Component
- BOJ
- ์๋ฃ๊ตฌ์กฐ
- DOM
- Python
- ์๊ณ ๋ฆฌ์ฆ
- Context API
- CSS
- error
- Browser
- react
- ๋ธ๋ผ์ฐ์
- github
- React Query
- ์ ๋ ฌ
- state
- ํ์ด์ฌ
- JavaScript
- ๊ทธ๋ํ
- ๋ฆฌ์กํธ
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
๊ธ ๋ณด๊ดํจ
250x250