已废弃 Gecko 37 (Firefox 37 / Thunderbird 37 / SeaMonkey 2.34)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

非标准
该特性是非标准的，请尽量不要在生产环境中使用它！

## 概述

将字符串中包含的特殊字符进行转义(反斜杠),然后在字符串两边各加上一个双引号(`"`)并返回,并不修改原字符串.

## 语法

    str.quote()

## 示例

`str` | `str.quote()` | `eval(str.quote())`
--- | --- | ---
`Hello world!` | `"Hello world!"` | `Hello world!`
`Hello world!` | `"Hello\n\tworld!"` | `Hello world!`
`" \ — '` | `"\" \\ \u2014 '"` | `" \ — '`

## 规范

不在任何规范中。实现于 JavaScript 1.3.

## 浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

- Desktop
- Mobile

Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari
--- | --- | --- | --- | --- | ---
Basic support | 未实现 | 未实现 | 未实现 | 未实现 | 未实现

Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile
--- | --- | --- | --- | --- | --- | ---
Basic support | 未实现 | 未实现 | 未实现 | 未实现 | 未实现 | 未实现

## 相关链接

- `JSON.stringify`