bytesEqual

function bytesEqual(bytes1, bytes2): boolean;

Returns true if and only if the provided bytes1 and bytes2 byte arrays are equal.

Parameters

ParameterTypeDescription
bytes1| ReadonlyUint8Array | Uint8Array<ArrayBufferLike>The first byte array to compare.
bytes2| ReadonlyUint8Array | Uint8Array<ArrayBufferLike>The second byte array to compare.

Returns

boolean

Example

const bytes1 = new Uint8Array([0x01, 0x02, 0x03, 0x04]);
const bytes2 = new Uint8Array([0x01, 0x02, 0x03, 0x04]);
bytesEqual(bytes1, bytes2); // true

On this page