Escape a string for JavaScript. It will escape characters like '
, "
, \n
, \r
, and <
. Handy if you're putting some HTML into JavaScript, e.g. you have some JSON with HTML in it and call JSON.parse
on it.
Syntax:
escapeJS(source-string)
source-string.escapeJS()