title: Printing the contents of a Javascript Uint8Array as raw bytes
body: <p>I have a Uint8Array in Javascript that I would like to print the contents of to the console, eg</p>
  
  <pre><code>255, 19, 42, 0
  </code></pre>
  
  <p>This is my code, which currently prints an empty string</p>
  
  <pre><code>    var bytes = new Uint8Array(data);
  
      var debugBytes = "";
      for(var i=0; i&lt;bytes.byteLength; i++) {
          debugBytes.concat(bytes[i].toString());
          debugBytes.concat(",");
      }
  
      console.log('Processing packet [' + bytes[1] + '] ' + debugBytes);
  </code></pre>
  
  <p>I can see the data in the debugger if I set a breakpoint, so bytes is definitely getting filled. When I tried printing via another method, it converted all the bytes to ASCII, but my data is mostly outside of the ASCII printable range.</p>
  
  <p>Is there an equivalent to printf() in JavaScript?</p>