After reviewing the examples provided for Uint8ClampedArray and Uint8Array, it appears that the main distinction lies in how values are handled upon assignment.
When attempting to assign a value outside the range of 0-255 to an element in a clamped array, it will automatically default to either 0 or 255 based on whether the value is lower or higher than the limits. On the other hand, a standard Uint8Array
simply takes the first 8 bits of the value without any adjustment.
Here are a few examples:
var x = new Uint8ClampedArray([17, -45.3]);
console.log(x[0]); // 17
console.log(x[1]); // 0
console.log(x.length); // 2
var x = new Uint8Array([17, -45.3]);
console.log(x[0]); // 17
console.log(x[1]); // 211
console.log(x.length); // 2