String to Bytes

Convert a string to a UTF-8 byte array.

Code

Utilities
[...new TextEncoder().encode(str)];

Parameters

Input string.

Browser·fetch() may be limited by CORS

More JavaScript Snippets