ArrayBuffer() 생성자

ArrayBuffer() 생성자는 ArrayBuffer 객체를 생성합니다.

구문

new ArrayBuffer(length)

매개변수

length
생성할 ArrayBuffer의 바이트 크기.

반환 값

지정한 크기를 가진 새로운 ArrayBuffer 객체. 내용은 모두 0으로 초기화됩니다.

예외

lengthNumber.MAX_SAFE_INTEGER보다 크거나, 음수면 RangeError.

예제

아래 예제 코드는 8바이트 버퍼를 생성한 후 Int32Array 뷰로 그 버퍼를 참조합니다.

var buffer = new ArrayBuffer(8);
var view   = new Int32Array(buffer);

명세

Specification
ECMAScript (ECMA-262)
The definition of 'ArrayBuffer' in that specification.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
ArrayBuffer() constructorChrome Full support 7Edge Full support 12Firefox Full support 4IE Full support 10Opera Full support 11.6Safari Full support 5.1WebView Android Full support 4Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 12Safari iOS Full support 4.2Samsung Internet Android Full support 1.0nodejs Full support 0.10
ArrayBuffer() without new throwsChrome Full support 7Edge Full support 14Firefox Full support 44IE No support NoOpera Full support 15Safari Full support 5.1WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 44Opera Android Full support 14Safari iOS Full support 5Samsung Internet Android Full support 1.0nodejs Full support 0.12

Legend

Full support  
Full support
No support  
No support

같이 보기