new Uint8Array(length);
new Uint8Array(typedArray);
new Uint8Array(object);
new Uint8Array(buffer [, byteOffset [, length]]);
In this case, you're not passing in buffer, but typedArray - so the next 2 arguments are not being used. If you instead so (new Uint8Array(b.buffer,0,5)).length it'll work
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As I'd said above, Chrome is spec compliant. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
The constructor is:
In this case, you're not passing in
buffer
, buttypedArray
- so the next 2 arguments are not being used. If you instead so(new Uint8Array(b.buffer,0,5)).length
it'll work