What is the behavior of text encode when OOM occurs

I have some questions about the behavior of encode.

For example, with the following code, when we encode a very large string, the result is an empty array.

So if memory allocation fails due to insufficient system memory or other reasons, and the returned Uint8Array is not successfully created, what will we get? An empty array, an exception, or an OOM crash?

const encoder = new TextEncoder();
const encoded = encoder.encode(largeText);
What is the behavior of text encode when OOM occurs
 
 
Q