Skip to content

Commit 475d42a

Browse files
committed
Add Translate the questions 55-63 to Korean.
1 parent d6a5a2e commit 475d42a

File tree

1 file changed

+299
-0
lines changed

1 file changed

+299
-0
lines changed

README-ko_KR.md

+299
Original file line numberDiff line numberDiff line change
@@ -1656,3 +1656,302 @@ let x = y;
16561656

16571657
</p>
16581658
</details>
1659+
1660+
---
1661+
1662+
###### 55. 무엇이 출력 될까요?
1663+
1664+
```javascript
1665+
class Dog {
1666+
constructor(name) {
1667+
this.name = name;
1668+
}
1669+
}
1670+
1671+
Dog.prototype.bark = function() {
1672+
console.log(`Woof I am ${this.name}`);
1673+
};
1674+
1675+
const pet = new Dog("Mara");
1676+
1677+
pet.bark();
1678+
1679+
delete Dog.prototype.bark;
1680+
1681+
pet.bark();
1682+
```
1683+
1684+
- A: `"Woof I am Mara"`, `TypeError`
1685+
- B: `"Woof I am Mara"`,`"Woof I am Mara"`
1686+
- C: `"Woof I am Mara"`, `undefined`
1687+
- D: `TypeError`, `TypeError`
1688+
1689+
<details><summary><b>Answer</b></summary>
1690+
<p>
1691+
1692+
#### Answer: A
1693+
1694+
프로토타입에서도 `delete`키워드를 사용해, 객체로부터 속성을 삭제할 수 있어요. 프로토타입에서 속성을 삭제하면, 프로토타입 체인에서 더 이상 사용할 수 없게 돼요. 이경우, `bark`함수는 `delete Dog.prototype.bark` 후에 프로토타입에서 더 이상 사용할 수 없게 되지만, 그래도 여전히 그것에 접근하려고 해요.
1695+
1696+
함수가 아닌 것을 호출하려고 할 때, `TypeError`가 던져져요. 이경우 `pet.bark``undefined`이기 때문에, `TypeError: pet.bark is not a function`예요.
1697+
1698+
</p>
1699+
</details>
1700+
1701+
---
1702+
1703+
###### 56. 무엇이 출력 될까요?
1704+
1705+
```javascript
1706+
const set = new Set([1, 1, 2, 3, 4]);
1707+
1708+
console.log(set);
1709+
```
1710+
1711+
- A: `[1, 1, 2, 3, 4]`
1712+
- B: `[1, 2, 3, 4]`
1713+
- C: `{1, 1, 2, 3, 4}`
1714+
- D: `{1, 2, 3, 4}`
1715+
1716+
<details><summary><b>Answer</b></summary>
1717+
<p>
1718+
1719+
#### Answer: D
1720+
1721+
`Set`_unique_ 값의 집합 객체예요: 값은 set 내에서 단 한 번만 발생해요.
1722+
1723+
중복 값 `1`을 가진 반복 가능한 `[1, 1, 2, 3, 4]`을 전달하기 때문에, 그들 중 하나는 삭제돼요. 이것은 결과적으로 `{1, 2, 3, 4}`돼요.
1724+
1725+
</p>
1726+
</details>
1727+
1728+
---
1729+
1730+
###### 57. 무엇이 출력 될까요?
1731+
1732+
```javascript
1733+
// counter.js
1734+
let counter = 10;
1735+
export default counter;
1736+
```
1737+
1738+
```javascript
1739+
// index.js
1740+
import myCounter from "./counter";
1741+
1742+
myCounter += 1;
1743+
1744+
console.log(myCounter);
1745+
```
1746+
1747+
- A: `10`
1748+
- B: `11`
1749+
- C: `Error`
1750+
- D: `NaN`
1751+
1752+
<details><summary><b>Answer</b></summary>
1753+
<p>
1754+
1755+
#### Answer: C
1756+
1757+
import 된 모듈은 _read-only_ 예요 : import 된 모듈은 수정할 수 없어요. export 한 모듈만 값을 변경할 수 있어요.
1758+
1759+
`myCounter`의 값을 증가 시키려고 할 때, 에러를 던져요: `myCounter`은 read-only이고 수정할 수 없어요.
1760+
1761+
</p>
1762+
</details>
1763+
1764+
---
1765+
1766+
###### 58. 무엇이 출력 될까요?
1767+
1768+
```javascript
1769+
const name = "Lydia";
1770+
age = 21;
1771+
1772+
console.log(delete name);
1773+
console.log(delete age);
1774+
```
1775+
1776+
- A: `false`, `true`
1777+
- B: `"Lydia"`, `21`
1778+
- C: `true`, `true`
1779+
- D: `undefined`, `undefined`
1780+
1781+
<details><summary><b>Answer</b></summary>
1782+
<p>
1783+
1784+
#### Answer: A
1785+
1786+
`delete`연산자는 불린 값을 리턴해요: 성공적으로 삭제를 한 경우 `true`를, 그렇지 않다면 `false`를 리턴해요. 그러나, `var`, `const` 또는 `let` 키워드로 선언된 변수들은 `delete`연산자를 사용해서 삭제될 수 없어요.
1787+
1788+
`name` 변수는 `const`키워드로 선언되었기 때문에, 삭제에 실패해요. `age``21`로 설정할 때, 실제로는 `age`라는 속성을 전역 객체에 추가한 거죠. 이 방법으로 객체, 전역 객체의 속성들을 성공적으로 삭제할 수 있어요. `delete age``true`을 리턴해요.
1789+
1790+
</p>
1791+
</details>
1792+
1793+
---
1794+
1795+
###### 59. 무엇이 출력 될까요?
1796+
1797+
```javascript
1798+
const numbers = [1, 2, 3, 4, 5];
1799+
const [y] = numbers;
1800+
1801+
console.log(y);
1802+
```
1803+
1804+
- A: `[[1, 2, 3, 4, 5]]`
1805+
- B: `[1, 2, 3, 4, 5]`
1806+
- C: `1`
1807+
- D: `[1]`
1808+
1809+
<details><summary><b>Answer</b></summary>
1810+
<p>
1811+
1812+
#### Answer: C
1813+
1814+
구조 분해 할당을 통해 객체의 배열 또는 속성들로부터 변수를 해체할 수 있어요. 예를 들어:
1815+
1816+
```javascript
1817+
[a, b] = [1, 2];
1818+
```
1819+
1820+
<img src="https://i.imgur.com/ADFpVop.png" width="200">
1821+
1822+
`a`는 이제 `1`이고, `b`는 이제 `2`예요. 질문에서 실제로 한 건 다음과 같아요:
1823+
1824+
```javascript
1825+
[y] = [1, 2, 3, 4, 5];
1826+
```
1827+
1828+
<img src="https://i.imgur.com/NzGkMNk.png" width="200">
1829+
1830+
이것은 `y`의 값은 숫자 `1`인 배열의 첫번째 값과 같다는 것을 의미하죠. `y`를 출력하면 `1`이 리턴돼요.
1831+
1832+
</p>
1833+
</details>
1834+
1835+
---
1836+
1837+
###### 60. 무엇이 출력 될까요?
1838+
1839+
```javascript
1840+
const user = { name: "Lydia", age: 21 };
1841+
const admin = { admin: true, ...user };
1842+
1843+
console.log(admin);
1844+
```
1845+
1846+
- A: `{ admin: true, user: { name: "Lydia", age: 21 } }`
1847+
- B: `{ admin: true, name: "Lydia", age: 21 }`
1848+
- C: `{ admin: true, user: ["Lydia", 21] }`
1849+
- D: `{ admin: true }`
1850+
1851+
<details><summary><b>Answer</b></summary>
1852+
<p>
1853+
1854+
#### Answer: B
1855+
1856+
스프레드 연산자 `...`를 사용해 객체를 결합할 수 있어요. 이것은 하나의 객체의 키/값의 쌍들을 복사본들을 만들어, 다른 객체에 추가해요. 이 경우, `user` 객체의 복사 본들을 만들어, `admin` 객체에 추가해요. `admin` 객체는 이제 복사된 키/값의 쌍들이 들어있고, 결과는 `{ admin: true, name: "Lydia", age: 21 }`예요.
1857+
1858+
</p>
1859+
</details>
1860+
1861+
---
1862+
1863+
###### 61. 무엇이 출력 될까요?
1864+
1865+
```javascript
1866+
const person = { name: "Lydia" };
1867+
1868+
Object.defineProperty(person, "age", { value: 21 });
1869+
1870+
console.log(person);
1871+
console.log(Object.keys(person));
1872+
```
1873+
1874+
- A: `{ name: "Lydia", age: 21 }`, `["name", "age"]`
1875+
- B: `{ name: "Lydia", age: 21 }`, `["name"]`
1876+
- C: `{ name: "Lydia"}`, `["name", "age"]`
1877+
- D: `{ name: "Lydia"}`, `["age"]`
1878+
1879+
<details><summary><b>Answer</b></summary>
1880+
<p>
1881+
1882+
#### Answer: B
1883+
1884+
`defineProperty`메소드로, 객체에 새로운 속성들을 추가하거나, 기존 것을 수정할 수 있어요. `defineProperty` 메소드를 사용해 객체의 속성을 추가할 때, 기본적으로 객체의 속성들은 _비 열거자_ 예요. `Object.keys`메소드는 모든 _열거자_ 객체의 속성 이름들을 리턴하는데, 이 경우는 `"name"` 뿐이에요.
1885+
1886+
`defineProperty`를 사용해 추가된 속성들은 기본적으로 변경할 수 없어요. `writable`, `configurable` 그리고 `enumerable` 속성들을 사용해 덮어쓰기 할 수 있어요. `defineProperty`메소드의 방법은 객체에 추가할 속성들을 훨씬 더 정교 하게 제어하도록 해줘요.
1887+
1888+
</p>
1889+
</details>
1890+
1891+
---
1892+
1893+
###### 62. 무엇이 출력 될까요?
1894+
1895+
```javascript
1896+
const settings = {
1897+
username: "lydiahallie",
1898+
level: 19,
1899+
health: 90
1900+
};
1901+
1902+
const data = JSON.stringify(settings, ["level", "health"]);
1903+
console.log(data);
1904+
```
1905+
1906+
- A: `"{"level":19, "health":90}"`
1907+
- B: `"{"username": "lydiahallie"}"`
1908+
- C: `"["level", "health"]"`
1909+
- D: `"{"username": "lydiahallie", "level":19, "health":90}"`
1910+
1911+
<details><summary><b>Answer</b></summary>
1912+
<p>
1913+
1914+
#### Answer: A
1915+
1916+
`JSON.stringify` 두번째 인수는 _replacer_ 예요. replacer는 함수 또는 배열 둘 중 하나가 될 수 있고, stringify 할 대상과 방법을 제어 할 수 있게 해줘요.
1917+
1918+
replacer가 _배열_ 이라면, 배열에 이름이 포함된 속성만 JSON 문자열에 추가될 거에요. 이 경우, 이름을 가진 `"level"` 그리고 `"health"`속성들만 포함되고, `"username"`은 제외되요. `data` 은 이제 `"{"level":19, "health":90}"`에요.
1919+
1920+
replacer가 _함수_ 라면, stringifying 할 객체의 모든 속성에 호출돼요. 이 함수로부터 리턴된 값은 JSON 문자열에 추가될 때 속성의 값이 될 거에요. 만약 값이 `undefined`라면, 이 속성은 JSON 문자열로부터 제외돼요.
1921+
1922+
</p>
1923+
</details>
1924+
1925+
---
1926+
1927+
###### 63. 무엇이 출력 될까요?
1928+
1929+
```javascript
1930+
let num = 10;
1931+
1932+
const increaseNumber = () => num++;
1933+
const increasePassedNumber = number => number++;
1934+
1935+
const num1 = increaseNumber();
1936+
const num2 = increasePassedNumber(num1);
1937+
1938+
console.log(num1);
1939+
console.log(num2);
1940+
```
1941+
1942+
- A: `10`, `10`
1943+
- B: `10`, `11`
1944+
- C: `11`, `11`
1945+
- D: `11`, `12`
1946+
1947+
<details><summary><b>Answer</b></summary>
1948+
<p>
1949+
1950+
#### Answer: A
1951+
1952+
단항 연산자 `++`_우선_ 피연산자의 값을 _리턴하고_, _그 후_ 피연산자의 값을 _증가해요_. `increaseNumber` 함수이 처음으로 리턴 한 `num`의 값은 `10` 이기 때문에, `num1`의 값은 `10`이고, 그 후엔 `num`의 값만 증가해요.
1953+
1954+
`num1``increasePassedNumber`로 전달했기 때문에, `num2``10`이에요. `number``10`이에요(`num1`의 값은, 다시 한번, 단항 연산자가 `++`_우선_ 피연산자의 값을 _리턴하고_, _그 후_ 피연산자의 값을 _증가해요_. `number`의 값은 `10`이에요 즉, `num2``10`이죠.
1955+
1956+
</p>
1957+
</details>

0 commit comments

Comments
 (0)