I need to insert a 2-byte number (ranging from 0 to 65,536) into a UInt8Array. For inserting a single byte number, I can easily refer to its index in the array like this:
let bufarray = new Uint8Array(buffer);
bufarray[0] = 1;
However, I am unsure of how to add a 2-byte number to a UInt8Array in Javascript/Typescript. Any guidance is appreciated.