Add value to Uint8Array - Javascript Language Basics

Javascript examples for Language Basics:Uint8Array

Description

Add value to Uint8Array

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w  w w  . j  a v  a  2 s . co m
var array = new Uint8Array(3);
array[0] = 0xe2;
array[1] = 0x82;
array[2] = 0xac;
function uintToString(uintArray) {
    var encodedString = String.fromCharCode.apply(null, uintArray),
        decodedString = decodeURIComponent(escape(encodedString));
    return decodedString;
}
console.log(uintToString(array));
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials