Escapes the value for insertion in JavaScript output.

For example:

{{ value|escapejs }}

When the value is he'llo then the output is he\x27llo.

Internally, this calls z_utils:js_escape/1 to perform the escaping.

Note: when generating JSON output, be sure to use filter-escapejson, as JSON escaping is subtly different from JS escaping.

See also

escape, filter-escapejson