Skip to content

Commit

Permalink
[ko] DataView.prototype.setUint8() 추가 (mdn#18751)
Browse files Browse the repository at this point in the history
* [ko] DataView.prototype.setUint8() 추가

- DataView.prototype.setUint8() 추가

* [ko] 리뷰사항 반영
  • Loading branch information
wisedog authored and ciyoe committed Apr 20, 2024
1 parent c8abba8 commit 0b60a38
Showing 1 changed file with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: DataView.prototype.setUint8()
slug: Web/JavaScript/Reference/Global_Objects/DataView/setUint8
l10n:
sourceCommit: e01fd6206ce2fad2fe09a485bb2d3ceda53a62de
---

{{JSRef}}

{{jsxref("DataView")}} 인스턴스의 **`setUint8()`** 메서드는 숫자를 받아
`DataView`의 지정된 바이트 오프셋의 1 바이트의 공간에 8비트 부호 없는 정수로 저장합니다.

{{EmbedInteractiveExample("pages/js/dataview-setuint8.html")}}

## 구문

```js-nolint
setUint8(byteOffset, value)
```

### 매개변수

- `byteOffset`
- : 데이터를 저장할 데이터 뷰의 시작점으로부터의 바이트 단위의 오프셋.
- `value`
- : 저장할 값. 어떻게 값이 바이트로 인코딩되는지는 [값 인코딩 및 정규화](/ko/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#value_encoding_and_normalization)를 보시기 바랍니다.

### 반환 값

{{jsxref("undefined")}}.

### 예외

- {{jsxref("RangeError")}}
- : 뷰의 끝을 넘어 읽는 수도 있는 `byteOffset`이 설정된 경우 발생합니다.

## 예제

### setUint8() 사용하기

```js
const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setUint8(0, 3);
dataview.getUint8(0); // 3
```

## 명세서

{{Specifications}}

## 브라우저 호환성

{{Compat}}

## 같이 보기

- [JavaScript 형식화 배열](/ko/docs/Web/JavaScript/Guide/Typed_arrays) 가이드
- {{jsxref("DataView")}}
- {{jsxref("ArrayBuffer")}}
- {{jsxref("Uint8Array")}}

0 comments on commit 0b60a38

Please sign in to comment.