TypedArr (TA13)
1: const buffer = new ArrayBuffer(2);
2: const view = new DataView(buffer);
3: view.setUint16(0, 0x1234, true); // true for Little-endian
4:
5: const byteArray = new Uint8Array(buffer);
6: const isLittleEndian = byteArray[0] === 0x34 && byteArray[1] === 0x12;
7: console.log(isLittleEndian ? "Little-endian" : "Big-endian");
Check the Endianness of the System Little-endian Little-endian: Most modern systems (e.g., x86, x64, ARM) use little-endian architecture. In little-endian, the least significant byte (LSB) is stored at the lowest memory address. Big-endian: Some older systems (e.g., PowerPC, SPARC) use big-endian architecture. In big-endian, the most significant byte (MSB) is stored at the lowest memory address. The DataView API allows you to explicitly specify the endianness when reading or writing multi-byte values. By default, it uses the platform's native endianness, but you can override this behavior.
TypedArr context:
ES6 context:
- (2024) Notes about JS Closures. #ES6
- (2024) Notes about Javascript asynchronous programming. #ES6
- (2022) Modern Javascript books #ES6 #Doc
- (2021) JS learning start point #ES6
- (2021) Maximilian Schwarzmüller Javascript lecture #ES6
- (2021) Javascript interview question from Happy Rawat #ES6
- (2021) Javascript tests #ES6
- (2016) New unique features of Javascript (updated). #ES6
Binary context:
- (2019) How to change image Exif metadata #Binary
- (2018) З'ясування алгоритмів оновлення Documat-CD SEB. #Binary
- (2016) JS6 Typed Array #ES6 #Binary
- (2015) Сховище графіки на SQL FileStream та канал браузеру multipart/form-data. #Sql #WebServiceClient #Binary
- (2012) Робота з байтами у VB.NET - ChrW, BitConverter.ToInt32, Convert.ToInt32, Byte.Parse, ToString("X2") / AllowHexSpecifier, GetBytes/GetString, New Byte(N) {}, UInt32 = &H33 #Binary #NetCommon
- (2005) DumpExe - утилитка дампирования структуры NET-сборок с открытым исходным текстом. #Binary #WinDesktop
- (2003) DVD - формат и обзор техник работы с ним. #Binary
- (2002) PE - формат исполняемого файла. #Binary
- (2002) FRX-парсер - моя утилитка для выкусывания рисунков из шестерочного FRX-файла. #WinDesktop #Vb6 #Binary
Comments (
)

Link to this page:
http://www.vb-net.com/JavascriptES6/TA13.htm
|