The decode() method in TextDecoder API is used to takes a stream of bytes as input and emits a stream of code points. The TextEncoder decode() method takes an ArrayBuffer containing the encoded data and options object and returns the original string (i.e. decoded string).
- buffer: It is an ArrayBuffer, Dataview or TypedArray instance that contains the encoded data.
- options: It is optional parameter that holds an object containing some properties.
- stream: It is a boolean value. It is set to true if datas are processing in chunks and false if datas are not chunked (by dafault its value set to false)
Return Value: It decodes the encoded input in buffer and returns the decoded string.
Before Clicking the Button:
After Clicking the Button: