| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray | [Back] [Original] |
Get to know MDN better
Uint8ClampedArray8 0-255 8 [0,255] 0 255 0
new Uint8ClampedArray(length); new Uint8ClampedArray(typedArray); new Uint8ClampedArray(object); new Uint8ClampedArray(buffer [, byteOffset [, length]]);
Uint8ClampedArray.BYTES_PER_ELEMENT Uint8ClampedArray 1
Uint8ClampedArray.prototype.lengthUint8ClampedArray.prototypeTypedArray
Uint8ClampedArray.from() Uint8ClampedArray Array.from()
Uint8ClampedArray.of() Uint8ClampedArray Array.of()
Uint8ClampedArray.prototype.constructor Uint8ClampedArray
Uint8ClampedArray.prototype.buffer Uint8ClampedArray ArrayBuffer
Uint8ClampedArray.prototype.byteLength ArrayBuffer Uint8ClampedArray
Uint8ClampedArray.prototype.byteOffset ArrayBuffer Uint8ClampedArray
Uint8ClampedArray.prototype.length UintClamped8Array
Uint8ClampedArray
// From a length
var uintc8 = new Uint8ClampedArray(2);
uintc8[0] = 42;
uintc8[1] = 1337;
console.log(uintc8[0]); // 42
console.log(uintc8[1]); // 255 (clamped)
console.log(uintc8.length); // 2
console.log(uintc8.BYTES_PER_ELEMENT); // 1
// From an array
var arr = new Uint8ClampedArray([21, 31]);
console.log(arr[1]); // 31
// From another TypedArray
var x = new Uint8ClampedArray([21, 31]);
var y = new Uint8ClampedArray(x);
console.log(y[0]); // 21
// From an ArrayBuffer
var buffer = new ArrayBuffer(8);
var z = new Uint8ClampedArray(buffer, 1, 4);
// From an iterable
var iterable = (function* () {
yield* [1, 2, 3];
})();
var uintc8 = new Uint8ClampedArray(iterable);
// Uint8ClampedArray[1, 2, 3]
| ECMAScript 2027 LanguageSpecification # sec-typedarray-objects |
ECMAScript 2015 Uint8ClampedArray new new Uint8ClampedArray TypeError
var dv = Uint8ClampedArray([1, 2, 3]);
// TypeError: calling a builtin Uint8ClampedArray constructor
// without new is forbidden
var dv = new Uint8ClampedArray([1, 2, 3]);
Uint8ClampedArrayTypedArrayat()TypedArray.prototype.copyWithin()TypedArray.prototype.entries()TypedArray.prototype.every()TypedArray.prototype.fill()TypedArray.prototype.filter()TypedArray.prototype.find()TypedArray.prototype.findIndex()findLast()findLastIndex()TypedArray.prototype.forEach()TypedArray.prototype.includes()TypedArray.prototype.indexOf()TypedArray.prototype.join()TypedArray.prototype.keys()TypedArray.prototype.lastIndexOf()TypedArray.prototype.map()TypedArray.prototype.reduce()TypedArray.prototype.reduceRight()TypedArray.prototype.reverse()set()slice()TypedArray.prototype.some()TypedArray.prototype.sort()TypedArray.prototype.subarray()TypedArray.prototype.toLocaleString()toReversed()TypedArray.prototype.toSorted()toString()TypedArray.prototype.values()TypedArray.prototype.with()TypedArray.prototype[Symbol.iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()BigInt64ArrayBigUint64ArrayFloat16ArrayFloat32ArrayFloat64ArrayInt8ArrayInt16ArrayInt32ArrayUint8ArrayUint16ArrayUint32Array| Web Proxy Viewer | New URL | Original Page |