Converts the characters "&", "<", ">", '"', and "'" in str to their corresponding HTML entities.
str
将str中的字符"&"、"<"、">"、'"'和"'"转换为对应的HTML实体。
The string to escape. 要转义的字符串
The escaped string. 转义后的字符串
escape('<script>alert(1)</script>') // => <script>alert(1)</script> Copy
escape('<script>alert(1)</script>') // => <script>alert(1)</script>
Converts the characters "&", "<", ">", '"', and "'" in
strto their corresponding HTML entities.将
str中的字符"&"、"<"、">"、'"'和"'"转换为对应的HTML实体。