Skip to content

Function: escape() ​

ts
function escape(value): string;

Escapes HTML-sensitive characters in a string. 转义字符串中的 HTML 敏感字符。

Parameters ​

ParameterTypeDescription
valuestringThe source string / 源字符串

Returns ​

string

The escaped string / 转义后的字符串

Example ​

ts
escape('<script>')
// => '&lt;script&gt;'

Since ​

1.2.0

Released under the MIT License.