-1

I have a byte array.

sensor_id = [bytes[36],bytes[35],bytes[34],bytes[33]]

It holds the following hexadecimal values:

0x69, 0x72, 0x33, 0x88

I need to merge 69 72 33 88 into a string value without conversion => "69723388".

Thanks for helping.

dda
  • 6,030
  • 2
  • 25
  • 34

1 Answers1

1

You can convert the hexadecimal values to string by using toString(16). For more read the MDN Doc.

const arr = [0x69, 0x72, 0x33, 0x88];
const base16string = arr.map(item => item.toString(16));

console.log(base16string);
.as-console-wrapper {min-height: 100%!important; top: 0}
Sajeeb Ahamed
  • 6,070
  • 2
  • 21
  • 30