Hello,
Does JavaScript have a built-in function like PHP's addslashes
(or addcslashes
) function to add backslashes to characters that need escaping in a string?
For example, this:
This is a demo string with 'single-quotes' and "double-quotes".
...would become:
This is a demo string with \'single-quotes\' and \"double-quotes\".
Thanks,
Steve