Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

TypedArray.prototype.set()

set() 메서드는 형식화 배열 내에 여러 값을 저장합니다, 지정된 배열로부터 입력 값을 읽어.

구문

typedarr.set(array [,offset])
typedarr.set(typedarray [,offset])

매개변수

array
값을 복사할 배열. 소스 배열로부터 모든 값이 대상 배열로 복사됩니다, 소스 배열의 길이 + 오프셋이 대상 배열의 길이를 초과하지 않는 한, 그 경우에는 예외가 발생됩니다.
typedarray
소스 배열이 형식화 배열인 경우, 두 배열은 기본 ArrayBuffer를 같이 공유할 수 있습니다; 브라우저는 버퍼의 소스 범위를 대상(destination) 범위로 똑똑하게 복사합니다.
offset Optional
소스 array에서 값을 쓰기 시작하는 대상 배열의 오프셋. 이 값이 생략된 경우, 0으로 간주됩니다 (즉, 소스 array는 인덱스 0에서 시작하는 대상 배열 내 값을 덮어씁니다).

오류 발생

RangeError
offset이 가령 형식화 배열의 끝을 넘어서 저장하려고 설정된 경우 발생.

set 메서드 사용

var buffer = new ArrayBuffer(8);
var uint8 = new Uint8Array(buffer);

uint8.set([1,2,3], 3);

console.log(uint8); // Uint8Array [ 0, 0, 0, 1, 2, 3, 0, 0 ]

스펙

스펙 상태 설명
Typed Array Specification Obsolete ECMAScript 6에 의해 대체됨.
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'TypedArray.prototype.set' in that specification.
Standard ECMA 표준에서 초기 정의.
ECMAScript 2017 Draft (ECMA-262)
The definition of 'TypedArray.prototype.set' in that specification.
Draft  

브라우저 호환성

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 7.0 4.0 (2) 10 11.6 5.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.0 (Yes) 4.0 (2) 10 11.6 4.2

참조

문서 태그 및 공헌자

 이 페이지의 공헌자: Netaras
 최종 변경: Netaras,