TextEncoder()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

TextEncoder() 构造函数总是返回一个新创建的 TextEncoder 对象,该对象将生成具有 UTF-8 编码的字节流。

语法

js
new TextEncoder();

参数

无。

规范

Specification
Encoding
# ref-for-dom-textencoder①

浏览器兼容性

BCD tables only load in the browser

参见