How do I translate this Python to Javascript? BYTE_ARRAY = bytearray(b"x01")


I need to turn this line of Python to Javascript

BYTE_ARRAY = bytearray(b"x01")

Asked By: Miguel



Uint8Array is like the bytearray Python function. It is used to create a byte array from hexadecimal.

const BYTE_ARRAY = new Uint8Array([0x01]);


Answered By: iohans
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.