-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.

1 Answer 1

2

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}

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks you! I think this is what i've been looking for.
Glad to know that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.