Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ko] SharedArrayBuffer.prototype.maxByteLength 신규 번역 외 #22406

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,45 +1,71 @@
---
title: Set.prototype.forEach()
slug: Web/JavaScript/Reference/Global_Objects/Set/forEach
l10n:
sourceCommit: c2445ce1dc3a0170e2fbfdbee10e18a7455c2282
---

{{JSRef}}

**`forEach()`** 메서드는 주어진 함수를 `Set` 요소 각각에 대해 삽입 순서대로 실행합니다.
{{jsxref("Set")}} 인스턴스의 **`forEach()`** 메서드는 제공된 함수를 Set 요소 각각에 대해 삽입 순서대로 한 번씩 실행합니다.

{{EmbedInteractiveExample("pages/js/set-prototype-foreach.html")}}

## 구문

```js
mySet.forEach(callback[, thisArg])
```js-nolint
forEach(callbackFn)
forEach(callbackFn, thisArg)
```

### 매개변수

<dl><dt><code>callback</code></dt><dd>각 요소에 대해 실행할 함수. 다음 세 가지 인수를 받습니다.</dd><dd><dl><dt><code>currentValue</code>, <code>currentKey</code></dt><dd>처리할 현재 요소. <code>Set</code>은 키를 갖지 않으므로 두 인수 모두에 값을 전달합니다.</dd><dt><code>set</code></dt><dd><code>forEach()</code>를 호출한 <code>Set</code>.</dd></dl></dd><dt><code>thisArg</code></dt><dd><code>callback</code>을 실행할 때 <code>this</code>로 사용할 값.</dd></dl>
- `callback`
- : 각 요소에 대해 실행할 함수. 다음 세 가지 인수를 받습니다.
- `value`
- : 각 순회의 값
- `key`
- : 각 순회의 키. 이것은 언제나 `value`와 같습니다/
- `set`
- : 순회 중인 Set.
- `thisArg` {{optional_inline}}
- : `callbackFn`을 실행 중일 때 `this`값으로 사용할 값.

### 반환 값

{{jsxref("undefined")}}.
없음 ({{jsxref("undefined")}}).

## 설명

`forEach()` 메서드는 주어진 `callback`을 `Set`에 존재하는 요소에 대해 한 번씩 실행합니다. 삭제한 값에 대해선 실행하지 않습니다. 그러나 존재하되 값이 {{jsxref("undefined")}}인 경우엔 실행합니다.
`forEach()` 메서드는 주어진 `callback`을
`Set`에 존재하는 요소에 대해 한 번씩 실행합니다.
삭제한 값에 대해선 실행하지 않습니다.
그러나 존재하되 값이 {{jsxref("undefined")}}인 경우엔 실행합니다.

`callback`은 다음 세 인수와 함께 호출됩니다.

- **요소 값**
- **요소 키**
- **순회 중인 `Set` 객체**

그러나 `Set`은 키 값을 사용하지 않으므로, 처음 두 개의 매개변수 모두 **요소 값**을 받습니다. 이는 {{jsxref("Map.foreach", "Map")}}과 {{jsxref("Array.forEach","Array")}}에서 사용하는 `forEach()`와 동일한 형태를 유지하기 위해서입니다.
그러나 `Set`은 키 값을 사용하지 않으므로, 처음 두 개의 매개변수 모두 **요소 값**을 받습니다.
이는 {{jsxref("Map.foreach", "Map")}}과 {{jsxref("Array.forEach","Array")}}에서
사용하는 `forEach()`와 동일한 형태를 유지하기 위해서 입니다.

`thisArg` 매개변수를 `forEach()`에 제공한 경우 `callback`을 호출할 때 전달해 `this`의 값으로 쓰입니다. 전달하지 않으면 `undefined`를 사용하며, 최종 `this` 값은 {{jsxref("Operators/this", "함수의 <code>this</code>를 결정하는 평소 규칙", "", 0)}}을 따릅니다.
`thisArg` 매개변수를 `forEach()`에 제공한 경우
`callback`을 호출할 때 전달해 `this`의 값으로 쓰입니다.
전달하지 않으면 `undefined` 값이 넘어가 `this`의 값으로 사용됩니다.
궁국적으로 `callback`이 관찰할 수 있는 `this` 값은
[함수의 `this`를 결정하는 일반적인 규칙](/ko/docs/Web/JavaScript/Reference/Operators/this)에
따라 결정됩니다.

`forEach()`는 각각의 값을 한 번씩 방문하지만, 순회를 끝내기 전에 제거하고 다시 추가한 값은 예외입니다. 방문하기 전 제거한 값에 대해서는 `callback`을 호출하지 않습니다. `forEach()`가 끝나기 전 추가한 요소는 방문합니다.
`forEach()`는 각각의 값을 한 번씩 방문하지만,
순회를 끝내기 전에 제거하고 다시 추가한 값은 예외입니다.
방문하기 전 제거한 값에 대해서는 `callback`을 호출하지 않습니다.
`forEach()`가 끝나기 전 추가한 요소는 방문합니다.

`forEach()`는 `Set` 객체의 요소에 대해 `callback`을 실행만 하며 값을 반환하지는 않습니다.
`forEach()`는 `Set` 객체의 요소에 대해
`callback`을 실행만 하며 값을 반환하지는 않습니다.

## 예제

Expand All @@ -49,7 +75,7 @@ mySet.forEach(callback[, thisArg])

```js
function logSetElements(value1, value2, set) {
console.log("s[" + value1 + "] = " + value2);
console.log(`s[${value1}] = ${value2}`);
}

new Set(["foo", "bar", undefined]).forEach(logSetElements);
Expand All @@ -60,7 +86,7 @@ new Set(["foo", "bar", undefined]).forEach(logSetElements);
// "s[undefined] = undefined"
```

## 명세
## 명세서

{{Specifications}}

Expand Down
31 changes: 16 additions & 15 deletions files/ko/web/javascript/reference/global_objects/set/has/index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
title: Set.prototype.has()
slug: Web/JavaScript/Reference/Global_Objects/Set/has
l10n:
sourceCommit: 5e878acadb7afcf0443b619b1d2f70a4dfafd679
---

{{JSRef}}

**`has()`** 메서드는 `Set` 객체에 주어진 요소가 존재하는지 여부를 판별해 반환합니다.
{{jsxref("Set")}} 객체의 **`has()`** 메서드는
이 Set 객체에 주어진 요소가 존재하는지 여부를 판별해 반환합니다.

{{EmbedInteractiveExample("pages/js/set-prototype-has.html")}}

## 구문

```js
mySet.has(value);
```js-nolint
has(value)
```

### 매개변수
Expand All @@ -24,29 +27,27 @@ mySet.has(value);

`Set` 객체에 값이 존재하면 `true`, 아니면 `false`.

> **참고:** 기술적으로, `has()`는 [`sameValueZero`](/ko/docs/Web/JavaScript/Equality_comparisons_and_sameness#등가0_같음) 알고리즘을 사용해 요소의 존재 여부를 판별합니다.

## 예제

### `has()` 사용하기
### `has()` 메서드 사용하기

```js
var mySet = new Set();
const mySet = new Set();
mySet.add("foo");

mySet.has("foo"); // true
mySet.has("bar"); // false
console.log(mySet.has("foo")); // true
console.log(mySet.has("bar")); // false

var set1 = new Set();
var obj1 = { key1: 1 };
const set1 = new Set();
const obj1 = { key1: 1 };
set1.add(obj1);

set1.has(obj1); // true
set1.has({ key1: 1 }); // false, 형태만 같은 서로 다른 객체의 참조이기 때문
set1.add({ key1: 1 }); // set1의 요소가 2개로 늘어남
console.log(set1.has(obj1)); // true
console.log(set1.has({ key1: 1 })); // false, 형태만 같은 서로 다른 객체의 참조이기 때문
console.log(set1.add({ key1: 1 })); // set1의 요소가 2개로 늘어남
```

## 명세
## 명세서

{{Specifications}}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: SharedArrayBuffer.prototype.maxByteLength
slug: Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/maxByteLength
l10n:
sourceCommit: 16bacf2194dc9e9ff6ee5bcc65316547cf88a8d9
---

{{JSRef}}

{{jsxref("SharedArrayBuffer")}} 인스턴스의 **`maxByteLength`** 접근자 속성은 `SharedArrayBuffer`의 크기 조절이 가능한 바이트 단위의 최대 길이를 반환합니다.

## 설명

`maxByteLength` 접근자 속성은 설정 접근자 함수가 `undefined`으로, 이 속성은 읽을 수만 있습니다. 이 값은 shared array가 생성될 때 설정되며, {{jsxref("SharedArrayBuffer/SharedArrayBuffer", "SharedArrayBuffer()")}} 생성자의 `maxByteLength` 옵션을 통해 설정되며 변경할 수 없습니다.

`SharedArrayBuffer` 값을 지정하지 않고 `SharedArrayBuffer`가 생성된 경우 이 속성은 `SharedArrayBuffer`의 {{jsxref("SharedArrayBuffer/byteLength", "byteLength")}}의 값과 같은 값을 반환합니다.

## 예제

### maxByteLength 사용하기

이 예제에서 최대 크기가 16바이트까지 크기 조절이 가능한 8바이트 버퍼를 만들고 이 버퍼의 `maxByteLength`를 반환합니다.

```js
const buffer = new SharedArrayBuffer(8, { maxByteLength: 16 });

buffer.maxByteLength; // 16
```

## 명세서

{{Specifications}}

## 브라우저 호환성

{{Compat}}

## 같이 보기

- {{jsxref("SharedArrayBuffer")}}