Is it possible to convert from 4x Uint8 into Uint32 using typed arrays in JavaScript?
问题 I'm doing some bitwise manipulation in a project and I wonder if the built-in typed arrays might save me some headache and maybe even give me a bit of a performance gain. let bytes = [128, 129, 130, 131] let uint32 = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3] //=> -2138996093 Can I use typed arrays to get the same answer ? // not actually working ! let uint8bytes = Uint8Array.from(bytes) let uint32 = Uint32Array.from(uint8bytes)[0] //=> ideally i'd get the same value as