(ES6) ES6 (2016)

TypedArr (TB04)

   1:  const buffer = new ArrayBuffer(8); // 8 bytes for multiple values
   2:  const view = new DataView(buffer);
   3:  
   4:  // Write a 16-bit integer and a 32-bit integer in little-endian format
   5:  view.setUint16(0, 0x1234, true); // 16-bit integer at offset 0
   6:  view.setUint32(2, 0x56789ABC, true); // 32-bit integer at offset 2
   7:  
   8:  // Read the values back
   9:  const uint16Value = view.getUint16(0, true);
  10:  const uint32Value = view.getUint32(2, true);
  11:  
  12:  console.log(uint16Value.toString(16)); // Output: "1234"
  13:  console.log(uint32Value.toString(16)); // Output: "56789abc"



Writing and Reading Multiple Values


1234
56789abc





TypedArr context:






ES6 context:




Binary context:



Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23>  <24>  <25
Link to this page: http://www.vb-net.com/JavascriptES6/TB04.htm
<TAGS>  <ARTICLES>  <FRONT>  <CORE>  <MVC>  <ASP>  <NET>  <DATA>  <TASK>  <XML>  <KIOSK>  <NOTES>  <SQL>  <LINUX>  <MONO>  <FREEWARE>  <DOCS> <TRAVELS> <FLOWERS> <RESUME> < THANKS ME>