escape
functionfunction escape(str: string): string
Escape characters for HTML text and quoted HTML attribute values This function does not make JavaScript, CSS, or URL values safe.
Parameters
str
stringString to escapeReturns
stringEscaped stringExample
escape('<script>alert("XSS")</script>')
// '<script>alert("XSS")</script>'
escape('A & B') // 'A & B'