Returns a copy of the string, replacing various special characters in the string with their escape sequences and wrapping the result in double-quotes (").
Method of String | |
|---|---|
| Implemented in | JavaScript ? |
| ECMAScript Edition | None |
Syntax
str.quote()
Examples
str | str.quote() | eval(str.quote()) |
|---|---|---|
Hello world! | "Hello world!" | Hello world! |
Hello | "Hello\n\tworld!" | Hello |
" \ — ' | \" \\ \u2014 ' | " \ — ' |