Javascript Uint8ClampedArray set()

Introduction

The Javascript Uint8ClampedArray set() method stores values in the typed array.

Uint8ClampedArray.set(array[, offset])
Uint8ClampedArray.set(Uint8ClampedArray[, offset])
Parameter Optional Meaning
arrayRequired The array from which to copy values.
Uint8ClampedArray Required If the source array to copy
offset Optional The offset into the target array to begin writing values. If you omit this value, 0 is assumed.

Using set()

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

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

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



PreviousNext

Related