Beta
Converts a string to a Uint16Array.
The string to convert
A Uint16Array representation of the string
const result = stringToUint16('hello world')deepEqual(result, new Uint16Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])); Copy
const result = stringToUint16('hello world')deepEqual(result, new Uint16Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));
Converts a string to a Uint16Array.