From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/global_objects/unescape/index.html | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/unescape/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/unescape/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/unescape/index.html b/files/zh-cn/web/javascript/reference/global_objects/unescape/index.html new file mode 100644 index 0000000000..b85895a7cd --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/unescape/index.html @@ -0,0 +1,84 @@ +--- +title: unescape() +slug: Web/JavaScript/Reference/Global_Objects/unescape +tags: + - JavaScript +translation_of: Web/JavaScript/Reference/Global_Objects/unescape +--- +
{{jsSidebar("Objects")}}
+ +

已废弃的unescape() 方法计算生成一个新的字符串,其中的十六进制转义序列将被其表示的字符替换。上述的转义序列就像{{jsxref("escape")}}里介绍的一样。因为 unescape 已经废弃,建议使用 {{jsxref("decodeURI")}}或者{{jsxref("decodeURIComponent")}} 替代本方法。

+ +
注意:不要使用unescape去解码URLS,使用decodeURI替代。
+ +

语法

+ +
unescape(str)
+ +

参数

+ +
+
str
+
被编码过的字符串。
+
+

返回值

+
+
一个未被转义的新字符串。
+
+ +

描述

+ +

unescape函数是全局对象的一个属性。

+ +

示例

+ +
unescape('abc123');     // "abc123"
+unescape('%E4%F6%FC');  // "äöü"
+unescape('%u0107');     // "ć"
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES1', '#sec-15.1.2.5', 'unescape')}}{{Spec2('ES1')}}Initial definition.
{{SpecName('ES5.1', '#sec-B.2.2', 'unescape')}}{{Spec2('ES5.1')}}Defined in the (informative) Compatibility Annex B
{{SpecName('ES6', '#sec-unescape-string', 'unescape')}}{{Spec2('ES6')}}Defined in the (normative) Annex B for Additional ECMAScript Features for Web Browsers
{{SpecName('ESDraft', '#sec-unescape-string', 'unescape')}}{{Spec2('ESDraft')}}Defined in the (normative) Annex B for Additional ECMAScript Features for Web Browsers
+ +

浏览器兼容

+ + + +

{{Compat("javascript.builtins.unescape")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf