A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/byteLength below:

TypedArray.prototype.byteLength - JavaScript | MDN

TypedArray.prototype.byteLength

Baseline Widely available

byteLength 접근자 속성은 형식화 배열의 길이(바이트)를 나타냅니다.

시도해 보기
// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(8);
const uint8 = new Uint8Array(buffer, 2);

console.log(uint8.byteLength);
// Expected output: 6
설명

byteLength 속성은 접근자 설정 함수가 undefined인 접근자 속성으로 이 속성은 읽을 수만 있습니다. 값은 TypedArray가 생성될 때 설정되며 변경할 수 없습니다. TypedArray가 byteOffset 또는 length를 지정하지 않으면 참조된 ArrayBuffer의 length가 반환됩니다. TypedArray는 TypedArray 객체 중 하나입니다.

예제 byteLength 속성 사용하기
const buffer = new ArrayBuffer(8);

const uint8 = new Uint8Array(buffer);
uint8.byteLength; // 8 (buffer의 byteLength와 일치)

const uint8newLength = new Uint8Array(buffer, 1, 5);
uint8newLength.byteLength; // 5 (Uint8Array를 만들 때 지정된 대로)

const uint8offSet = new Uint8Array(buffer, 2);
uint8offSet.byteLength; // 6 (생성된 Uint8Array의 오프셋으로 인해)
명세서 브라우저 호환성 같이 보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4