Escape text so it can appear safely inside a JavaScript string literal.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
Characters with syntactic meaning in JavaScript string literals are replaced with escape sequences such as backslash, quote, newline, or Unicode code-unit escapes. The result is source text, not a JavaScript value with executable behavior.
He said "hello" New line
He said \"hello\"\nNew line
Templates, inline-script fixtures, and serializers escape JavaScript string values.