TextEncoder.encode()
The TextEncoder.encode() method takes a string as input, and returns a Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
Syntax
encode(string)
Parameters
string- : A string containing the text to encode.
Return value
A Uint8Array object.