From d44f5032d0f53256b2d5aef505d6b593fd3cd158 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:14:18 +0800 Subject: fix yari h2m dry run errors (zh-CN) --- .../global_objects/array/concat/index.html | 2 +- .../global_objects/array/every/index.html | 2 +- .../reference/global_objects/array/flat/index.html | 2 +- .../global_objects/array/foreach/index.html | 10 ++- .../global_objects/array/includes/index.html | 6 +- .../reference/global_objects/array/index.md | 6 +- .../global_objects/array/indexof/index.html | 2 +- .../reference/global_objects/array/join/index.html | 12 +-- .../global_objects/array/length/index.html | 4 +- .../global_objects/array/reduce/index.html | 6 +- .../global_objects/array/reduceright/index.html | 30 ++++--- .../global_objects/array/slice/index.html | 4 +- .../reference/global_objects/array/some/index.html | 2 +- .../reference/global_objects/array/sort/index.html | 2 +- .../global_objects/array/values/index.html | 8 +- .../global_objects/asyncfunction/index.html | 2 +- .../global_objects/atomics/notify/index.html | 2 +- .../global_objects/atomics/wait/index.html | 2 +- .../global_objects/bigint/bigint/index.html | 4 +- .../reference/global_objects/bigint/index.html | 4 +- .../global_objects/bigint64array/index.html | 23 ++---- .../reference/global_objects/boolean/index.html | 4 +- .../global_objects/dataview/getfloat32/index.html | 8 +- .../global_objects/dataview/getfloat64/index.html | 8 +- .../global_objects/dataview/getint16/index.html | 8 +- .../global_objects/dataview/getint32/index.html | 8 +- .../global_objects/dataview/getint8/index.html | 4 +- .../global_objects/dataview/getuint16/index.html | 8 +- .../global_objects/dataview/getuint32/index.html | 8 +- .../global_objects/dataview/getuint8/index.html | 4 +- .../global_objects/dataview/setint8/index.html | 9 +-- .../reference/global_objects/date/date/index.html | 4 +- .../global_objects/date/getdate/index.html | 4 +- .../global_objects/date/getday/index.html | 8 +- .../global_objects/date/gethours/index.html | 4 +- .../global_objects/date/getmilliseconds/index.html | 4 +- .../global_objects/date/getminutes/index.html | 4 +- .../global_objects/date/getmonth/index.html | 4 +- .../global_objects/date/getseconds/index.html | 8 +- .../date/gettimezoneoffset/index.html | 2 +- .../reference/global_objects/date/index.html | 18 ++--- .../reference/global_objects/date/parse/index.html | 14 ++-- .../global_objects/date/setfullyear/index.html | 4 +- .../global_objects/date/settime/index.html | 7 +- .../global_objects/decodeuricomponent/index.html | 80 +------------------ .../reference/global_objects/encodeuri/index.html | 93 ++-------------------- .../global_objects/error/columnnumber/index.html | 52 +----------- .../global_objects/error/filename/index.html | 54 +------------ .../reference/global_objects/error/index.html | 44 +--------- .../global_objects/error/message/index.html | 75 +---------------- .../reference/global_objects/error/name/index.html | 75 +---------------- .../global_objects/error/tosource/index.html | 2 +- .../global_objects/error/tostring/index.html | 79 ++---------------- .../reference/global_objects/escape/index.html | 50 +----------- .../global_objects/finalizationregistry/index.html | 2 +- .../global_objects/float32array/index.html | 69 +--------------- .../global_objects/float64array/index.html | 69 +--------------- .../global_objects/function/apply/index.html | 12 ++- .../global_objects/function/arguments/index.html | 52 +----------- .../global_objects/function/bind/index.html | 2 +- .../global_objects/function/call/index.html | 6 +- .../global_objects/function/displayname/index.html | 56 +------------ .../global_objects/function/name/index.html | 6 +- .../global_objects/generator/next/index.html | 56 +------------ .../global_objects/generator/throw/index.html | 52 +----------- .../global_objects/generatorfunction/index.html | 2 +- .../reference/global_objects/infinity/index.html | 2 +- .../reference/global_objects/int16array/index.html | 69 +--------------- .../reference/global_objects/int32array/index.html | 67 +--------------- .../reference/global_objects/int8array/index.html | 67 +--------------- .../global_objects/internalerror/index.html | 50 +----------- .../global_objects/intl/datetimeformat/index.html | 55 +------------ .../global_objects/intl/numberformat/index.html | 8 +- .../global_objects/intl/pluralrules/index.html | 4 +- .../reference/global_objects/isfinite/index.html | 26 +----- .../reference/global_objects/isnan/index.html | 2 +- .../global_objects/json/stringify/index.html | 8 +- .../global_objects/map/@@tostringtag/index.html | 54 +------------ .../reference/global_objects/map/delete/index.html | 2 +- .../reference/global_objects/map/has/index.html | 50 +----------- .../reference/global_objects/map/index.html | 18 ++--- .../reference/global_objects/map/size/index.html | 4 +- .../reference/global_objects/map/values/index.html | 50 +----------- .../reference/global_objects/math/abs/index.html | 50 +----------- .../reference/global_objects/math/acos/index.html | 51 +----------- .../reference/global_objects/math/asin/index.html | 51 +----------- .../reference/global_objects/math/atan/index.html | 51 +----------- .../reference/global_objects/math/atan2/index.html | 50 +----------- .../reference/global_objects/math/atanh/index.html | 50 +----------- .../reference/global_objects/math/cbrt/index.html | 52 +----------- .../reference/global_objects/math/ceil/index.html | 9 +-- .../reference/global_objects/math/cos/index.html | 51 +----------- .../reference/global_objects/math/cosh/index.html | 50 +----------- .../reference/global_objects/math/e/index.html | 51 +----------- .../reference/global_objects/math/exp/index.html | 51 +----------- .../reference/global_objects/math/expm1/index.html | 50 +----------- .../reference/global_objects/math/floor/index.html | 61 ++------------ .../global_objects/math/fround/index.html | 52 +----------- .../reference/global_objects/math/imul/index.html | 52 +----------- .../reference/global_objects/math/index.html | 4 +- .../reference/global_objects/math/ln10/index.html | 51 +----------- .../reference/global_objects/math/ln2/index.html | 51 +----------- .../reference/global_objects/math/log/index.html | 50 +----------- .../reference/global_objects/math/log10/index.html | 50 +----------- .../global_objects/math/log10e/index.html | 51 +----------- .../reference/global_objects/math/log1p/index.html | 50 +----------- .../reference/global_objects/math/log2/index.html | 50 +----------- .../reference/global_objects/math/log2e/index.html | 51 +----------- .../reference/global_objects/math/min/index.html | 56 +------------ .../reference/global_objects/math/pi/index.html | 52 +----------- .../global_objects/math/random/index.html | 8 +- .../reference/global_objects/math/round/index.html | 57 ++----------- .../reference/global_objects/math/sign/index.html | 52 +----------- .../reference/global_objects/math/sinh/index.html | 54 +------------ .../global_objects/math/sqrt1_2/index.html | 51 +----------- .../reference/global_objects/math/sqrt2/index.html | 51 +----------- .../reference/global_objects/math/tan/index.html | 51 +----------- .../global_objects/number/epsilon/index.html | 50 +----------- .../number/max_safe_integer/index.html | 50 +----------- .../global_objects/number/max_value/index.html | 50 +----------- .../global_objects/number/min_value/index.html | 51 +----------- .../reference/global_objects/number/nan/index.html | 50 +----------- .../number/negative_infinity/index.html | 53 ++---------- .../global_objects/number/parsefloat/index.html | 56 +------------ .../number/positive_infinity/index.html | 50 +----------- .../global_objects/number/toexponential/index.html | 50 +----------- .../global_objects/number/tofixed/index.html | 2 +- .../number/tolocalestring/index.html | 2 +- .../global_objects/number/toprecision/index.html | 50 +----------- .../global_objects/number/tosource/index.html | 51 +----------- .../global_objects/number/tostring/index.html | 52 +----------- .../global_objects/number/valueof/index.html | 50 +----------- .../object/__definegetter__/index.html | 54 ++----------- .../object/__definesetter__/index.html | 54 ++----------- .../object/__lookupgetter__/index.html | 50 +----------- .../object/__lookupsetter__/index.html | 50 +----------- .../global_objects/object/assign/index.html | 4 +- .../object/defineproperty/index.html | 8 +- .../global_objects/object/entries/index.html | 4 +- .../global_objects/object/freeze/index.html | 2 +- .../object/getownpropertydescriptors/index.html | 2 +- .../object/getownpropertysymbols/index.html | 8 +- .../object/getprototypeof/index.html | 19 ++--- .../global_objects/object/isextensible/index.html | 48 +---------- .../global_objects/object/isfrozen/index.html | 8 +- .../global_objects/object/isprototypeof/index.html | 54 +------------ .../object/preventextensions/index.html | 8 +- .../global_objects/object/proto/index.html | 4 +- .../object/setprototypeof/index.html | 2 +- .../global_objects/object/tostring/index.html | 4 +- .../global_objects/object/valueof/index.html | 4 +- .../reference/global_objects/parsefloat/index.html | 8 +- .../reference/global_objects/parseint/index.html | 9 +-- .../global_objects/promise/any/index.html | 4 +- .../global_objects/promise/finally/index.html | 2 +- .../reference/global_objects/promise/index.html | 6 +- .../global_objects/promise/reject/index.html | 4 +- .../global_objects/promise/resolve/index.html | 8 +- .../global_objects/promise/then/index.html | 2 +- .../proxy/proxy/defineproperty/index.html | 50 +----------- .../proxy/proxy/deleteproperty/index.html | 50 +----------- .../global_objects/proxy/proxy/get/index.html | 50 +----------- .../proxy/getownpropertydescriptor/index.html | 50 +----------- .../global_objects/proxy/proxy/has/index.html | 52 +----------- .../global_objects/proxy/proxy/ownkeys/index.html | 52 +----------- .../global_objects/proxy/proxy/set/index.html | 2 +- .../reference/global_objects/rangeerror/index.html | 50 +----------- .../global_objects/referenceerror/index.html | 50 +----------- .../global_objects/reflect/construct/index.html | 52 +----------- .../reflect/defineproperty/index.html | 4 +- .../reflect/deleteproperty/index.html | 50 +----------- .../reflect/getownpropertydescriptor/index.html | 50 +----------- .../global_objects/reflect/has/index.html | 50 +----------- .../global_objects/reflect/isextensible/index.html | 50 +----------- .../global_objects/regexp/@@search/index.html | 50 +----------- .../global_objects/regexp/@@species/index.html | 50 +----------- .../global_objects/regexp/@@split/index.html | 50 +----------- .../global_objects/regexp/compile/index.html | 50 +----------- .../global_objects/regexp/exec/index.html | 12 +-- .../global_objects/regexp/flags/index.html | 50 +----------- .../global_objects/regexp/global/index.html | 51 +----------- .../global_objects/regexp/ignorecase/index.html | 51 +----------- .../reference/global_objects/regexp/index.html | 4 +- .../global_objects/regexp/input/index.html | 50 +----------- .../global_objects/regexp/lastindex/index.html | 53 ++---------- .../global_objects/regexp/lastmatch/index.html | 50 +----------- .../global_objects/regexp/lastparen/index.html | 50 +----------- .../global_objects/regexp/leftcontext/index.html | 50 +----------- .../global_objects/regexp/multiline/index.html | 51 +----------- .../reference/global_objects/regexp/n/index.html | 54 +------------ .../global_objects/regexp/regexp/index.html | 3 +- .../global_objects/regexp/rightcontext/index.html | 50 +----------- .../global_objects/regexp/source/index.html | 52 +----------- .../global_objects/regexp/tostring/index.html | 51 +----------- .../global_objects/regexp/unicode/index.html | 52 +----------- .../reference/global_objects/set/clear/index.html | 50 +----------- .../reference/global_objects/set/delete/index.html | 50 +----------- .../global_objects/set/entries/index.html | 52 +----------- .../global_objects/set/foreach/index.html | 50 +----------- .../reference/global_objects/set/has/index.html | 52 +----------- .../global_objects/sharedarraybuffer/index.html | 4 +- .../global_objects/string/@@iterator/index.html | 52 +----------- .../global_objects/string/anchor/index.html | 59 +------------- .../reference/global_objects/string/big/index.html | 52 +----------- .../global_objects/string/blink/index.html | 50 +----------- .../global_objects/string/bold/index.html | 50 +----------- .../global_objects/string/charat/index.html | 50 +----------- .../global_objects/string/charcodeat/index.html | 4 +- .../global_objects/string/codepointat/index.html | 50 +----------- .../global_objects/string/fixed/index.html | 50 +----------- .../global_objects/string/fontcolor/index.html | 56 +------------ .../global_objects/string/fontsize/index.html | 52 +----------- .../global_objects/string/fromcodepoint/index.html | 9 +-- .../global_objects/string/includes/index.html | 7 +- .../reference/global_objects/string/index.html | 60 ++------------ .../global_objects/string/indexof/index.html | 4 +- .../global_objects/string/italics/index.html | 52 +----------- .../global_objects/string/lastindexof/index.html | 59 ++------------ .../global_objects/string/length/index.html | 50 +----------- .../global_objects/string/match/index.html | 71 ++--------------- .../global_objects/string/matchall/index.html | 4 +- .../global_objects/string/padstart/index.html | 4 +- .../global_objects/string/repeat/index.html | 2 +- .../global_objects/string/replace/index.html | 8 +- .../global_objects/string/replaceall/index.html | 12 +-- .../global_objects/string/small/index.html | 50 +----------- .../global_objects/string/split/index.html | 8 +- .../global_objects/string/strike/index.html | 50 +----------- .../reference/global_objects/string/sub/index.html | 50 +----------- .../global_objects/string/substr/index.html | 54 +------------ .../global_objects/string/substring/index.html | 50 +----------- .../reference/global_objects/string/sup/index.html | 50 +----------- .../string/tolocalelowercase/index.html | 50 +----------- .../global_objects/string/tolowercase/index.html | 54 +------------ .../global_objects/string/tosource/index.html | 52 +----------- .../global_objects/string/tostring/index.html | 50 +----------- .../global_objects/string/trimend/index.html | 2 +- .../global_objects/string/trimstart/index.html | 2 +- .../reference/global_objects/symbol/for/index.html | 50 +----------- .../reference/global_objects/symbol/index.html | 8 +- .../global_objects/symbol/keyfor/index.html | 54 +------------ .../global_objects/symbol/search/index.html | 50 +----------- .../global_objects/symbol/split/index.html | 50 +----------- .../global_objects/symbol/toprimitive/index.html | 9 +-- .../global_objects/symbol/tosource/index.html | 54 +------------ .../global_objects/symbol/tostring/index.html | 50 +----------- .../global_objects/symbol/tostringtag/index.html | 50 +----------- .../global_objects/symbol/valueof/index.html | 50 +----------- .../global_objects/syntaxerror/index.html | 50 +----------- .../typedarray/@@iterator/index.html | 50 +----------- .../global_objects/typedarray/@@species/index.html | 50 +----------- .../global_objects/typedarray/buffer/index.html | 50 +----------- .../typedarray/bytelength/index.html | 50 +----------- .../typedarray/byteoffset/index.html | 50 +----------- .../typedarray/bytes_per_element/index.html | 52 +----------- .../typedarray/copywithin/index.html | 52 +----------- .../global_objects/typedarray/entries/index.html | 50 +----------- .../global_objects/typedarray/every/index.html | 52 +----------- .../global_objects/typedarray/fill/index.html | 50 +----------- .../global_objects/typedarray/filter/index.html | 50 +----------- .../global_objects/typedarray/find/index.html | 50 +----------- .../global_objects/typedarray/findindex/index.html | 50 +----------- .../global_objects/typedarray/foreach/index.html | 8 +- .../global_objects/typedarray/from/index.html | 2 +- .../global_objects/typedarray/includes/index.html | 52 +----------- .../global_objects/typedarray/indexof/index.html | 52 +----------- .../global_objects/typedarray/join/index.html | 52 +----------- .../global_objects/typedarray/keys/index.html | 52 +----------- .../typedarray/lastindexof/index.html | 52 +----------- .../global_objects/typedarray/length/index.html | 50 +----------- .../global_objects/typedarray/map/index.html | 50 +----------- .../global_objects/typedarray/name/index.html | 54 +------------ .../global_objects/typedarray/of/index.html | 52 +----------- .../global_objects/typedarray/reduce/index.html | 52 +----------- .../typedarray/reduceright/index.html | 52 +----------- .../global_objects/typedarray/reverse/index.html | 52 +----------- .../global_objects/typedarray/set/index.html | 50 +----------- .../global_objects/typedarray/some/index.html | 2 +- .../global_objects/typedarray/sort/index.html | 50 +----------- .../global_objects/typedarray/tostring/index.html | 50 +----------- .../global_objects/typedarray/values/index.html | 52 +----------- .../global_objects/uint8clampedarray/index.html | 84 +------------------ .../reference/global_objects/undefined/index.html | 6 +- .../reference/global_objects/unescape/index.html | 12 +-- .../reference/global_objects/uneval/index.html | 8 +- .../global_objects/weakmap/clear/index.html | 56 +------------ .../global_objects/weakmap/delete/index.html | 48 +---------- .../global_objects/weakmap/get/index.html | 48 +---------- .../global_objects/weakmap/has/index.html | 50 +----------- .../reference/global_objects/weakref/index.html | 2 +- .../global_objects/weakset/add/index.html | 48 +---------- .../global_objects/weakset/delete/index.html | 48 +---------- .../global_objects/weakset/has/index.html | 48 +---------- .../global_objects/webassembly/global/index.html | 10 +-- .../global_objects/webassembly/index.html | 2 +- .../global_objects/webassembly/instance/index.html | 7 +- .../webassembly/instantiate/index.html | 14 ++-- .../webassembly/instantiatestreaming/index.html | 8 +- .../global_objects/webassembly/memory/index.html | 10 +-- .../global_objects/webassembly/module/index.html | 2 +- .../global_objects/webassembly/table/index.html | 2 +- 301 files changed, 661 insertions(+), 9594 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects') diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/concat/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/concat/index.html index dbd74c0909..b612dc454f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/concat/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/concat/index.html @@ -44,7 +44,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/concat
-

注意:数组/值在连接时保持不变。此外,对于新数组的任何操作(仅当元素不是对象引用时)都不会对原始数组产生影响,反之亦然。

+

备注:数组/值在连接时保持不变。此外,对于新数组的任何操作(仅当元素不是对象引用时)都不会对原始数组产生影响,反之亦然。

示例

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/every/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/every/index.html index 38d4388b52..ae369c0559 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/every/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/every/index.html @@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/every

every() 方法测试一个数组内的所有元素是否都能通过某个指定函数的测试。它返回一个布尔值。

-

注意:若收到一个空数组,此方法在一切情况下都会返回 true

+

备注::若收到一个空数组,此方法在一切情况下都会返回 true

{{EmbedInteractiveExample("pages/js/array-every.html")}}
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/flat/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/flat/index.html index 4f06aff1fc..ec0af471c3 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/flat/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/flat/index.html @@ -76,7 +76,7 @@ arr.reduce((acc, val) => acc.concat(val), []); // 使用扩展运算符 ... const flattened = arr => [].concat(...arr); -

reduce + concat + isArray + recursivity

+

reduce + concat + isArray + recursivity

// 使用 reduce、concat 和递归展开无限多层嵌套的数组
   var arr1 = [1,2,3,[1,2,3,4, [2,3,4]]];
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/foreach/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/foreach/index.html
index 6f93bd4513..1c9a181656 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/array/foreach/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/array/foreach/index.html
@@ -65,7 +65,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/forEach
 

forEach() 被调用时,不会改变原数组,也就是调用它的数组(尽管 callback 函数在被调用时可能会改变原数组)。(译注:此处说法可能不够明确,具体可参考EMCA语言规范:'forEach does not directly mutate the object on which it is called but the object may be mutated by the calls to callbackfn.',即 forEach 不会直接改变调用它的对象,但是那个对象可能会被 callback 函数改变。)

-

注意: 除了抛出异常以外,没有办法中止或跳出 forEach() 循环。如果你需要中止或跳出循环,forEach() 方法不是应当使用的工具。

+

备注: 除了抛出异常以外,没有办法中止或跳出 forEach() 循环。如果你需要中止或跳出循环,forEach() 方法不是应当使用的工具。

若你需要提前终止循环,你可以使用:

@@ -129,8 +129,8 @@ items.forEach(function(item){

打印出数组的内容

-
-

注意:为了在控制台中显示数组的内容,你可以使用 console.table() 来展示经过格式化的数组。下面的例子则是另一种使用 forEach() 的格式化的方法。

+
+

备注:为了在控制台中显示数组的内容,你可以使用 console.table() 来展示经过格式化的数组。下面的例子则是另一种使用 forEach() 的格式化的方法。

下面的代码会为每一个数组元素输出一行记录:

@@ -174,7 +174,9 @@ obj.sum;

因为 thisArg 参数(this)传给了 forEach(),每次调用时,它都被传给 callback 函数,作为它的 this 值。

-
注意:如果使用箭头函数表达式来传入函数参数, thisArg 参数会被忽略,因为箭头函数在词法上绑定了 {{jsxref("Operators/this", "this")}} 值。
+
+

备注:如果使用箭头函数表达式来传入函数参数, thisArg 参数会被忽略,因为箭头函数在词法上绑定了 {{jsxref("Operators/this", "this")}} 值。

+

对象复制器函数

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html index 5001b155be..3fdd124719 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/includes/index.html @@ -28,8 +28,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes

需要查找的元素值。

-
-

Note: 使用 includes()比较字符串和字符时是区分大小写的。

+
+

备注:使用 includes()比较字符串和字符时是区分大小写的。

fromIndex {{optional_inline}}
@@ -43,7 +43,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes

0 的值将全部视为相等,与符号无关(即 -0 与 0 和 +0 相等),但 false 不被认为与 0 相等。

-

Note: 技术上来讲,includes() 使用 零值相等 算法来确定是否找到给定的元素。

+

备注: 技术上来讲,includes() 使用 零值相等 算法来确定是否找到给定的元素。

示例

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/index.md b/files/zh-cn/web/javascript/reference/global_objects/array/index.md index 70b70221e2..fa360b4d50 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/index.md +++ b/files/zh-cn/web/javascript/reference/global_objects/array/index.md @@ -232,9 +232,9 @@ const myArray = myRe.exec('cdbBdbsbz') - diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/indexof/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/indexof/index.html index a4ef7ead3b..3e24bae2c5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/indexof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/indexof/index.html @@ -17,7 +17,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/indexOf
{{EmbedInteractiveExample("pages/js/array-indexof.html")}}
-

注意:对于String方法,请参阅 {{jsxref("String.prototype.indexOf()")}}。

+

备注:对于String方法,请参阅 {{jsxref("String.prototype.indexOf()")}}。

语法

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/join/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/join/index.html index b4c06b6acb..defbf9c200 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/join/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/join/index.html @@ -23,18 +23,18 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/join
separator {{optional_inline}}
指定一个字符串来分隔数组的每个元素。如果需要,将分隔符转换为字符串。如果缺省该值,数组元素用逗号(,)分隔。如果separator是空字符串(""),则所有元素之间都没有任何字符。
-
-

返回值

-
-
一个所有数组元素连接的字符串。如果 arr.length 为0,则返回空字符串。
+

返回值

+ +

一个所有数组元素连接的字符串。如果 arr.length 为0,则返回空字符串。

+

描述

所有的数组元素被转换成字符串,再用一个分隔符将这些字符串连接起来。

-
-

如果一个元素为 undefined 或 null,它会被转换为空字符串。

+
+

警告:如果一个元素为 undefined 或 null,它会被转换为空字符串。

示例

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html index 1ee4198226..6731fc1d14 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/length/index.html @@ -82,7 +82,7 @@ function printEntries(arr) {

下面的例子中,通过数组下标遍历数组元素,并把每个元素的值修改为原值的2倍。

-
var numbers = [1, 2, 3, 4, 5];
+
var numbers = [1, 2, 3, 4, 5];
 var length = numbers.length;
 for (var i = 0; i < length; i++) {
   numbers[i] *= 2;
@@ -93,7 +93,7 @@ for (var i = 0; i < length; i++) {
 
 

下面的例子中,如果数组长度大于 3,则把该数组的长度截断为 3 。

-
var numbers = [1, 2, 3, 4, 5];
+
var numbers = [1, 2, 3, 4, 5];
 
 if (numbers.length > 3) {
   numbers.length = 3;
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html
index d52d65e268..348d717a0f 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/array/reduce/index.html
@@ -74,7 +74,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/Reduce
 

回调函数第一次执行时,accumulatorcurrentValue的取值有两种情况:如果调用reduce()时提供了initialValueaccumulator取值为initialValuecurrentValue取数组中的第一个值;如果没有提供 initialValue,那么accumulator取数组中的第一个值,currentValue取数组中的第二个值。

-

注意:如果没有提供initialValue,reduce 会从索引1的地方开始执行 callback 方法,跳过第一个索引。如果提供initialValue,从索引0开始。

+

备注:如果没有提供initialValue,reduce 会从索引1的地方开始执行 callback 方法,跳过第一个索引。如果提供initialValue,从索引0开始。

如果数组为空且没有提供initialValue,会抛出{{jsxref("TypeError")}} 。如果数组仅有一个元素(无论位置如何)并且没有提供initialValue, 或者有提供initialValue但是数组为空,那么此唯一值将被返回并且callback不会被执行。

@@ -450,8 +450,8 @@ var allbooks = friends.reduce(function(prev, curr) {

数组去重

-
-

注意: 如果你正在使用一个可以兼容{{jsxref("Set")}} 和 {{jsxref("Array.from()")}} 的环境, 你可以使用let orderedArray = Array.from(new Set(myArray)); 来获得一个相同元素被移除的数组。

+
+

备注: 如果你正在使用一个可以兼容{{jsxref("Set")}} 和 {{jsxref("Array.from()")}} 的环境, 你可以使用let orderedArray = Array.from(new Set(myArray)); 来获得一个相同元素被移除的数组。

let myArray = ['a', 'b', 'a', 'b', 'c', 'e', 'e', 'c', 'd', 'd', 'd', 'd']
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html
index 793a4fd3a3..8517f6e749 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/array/reduceright/index.html
@@ -27,28 +27,26 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/ReduceRight
 
callback
一个回调函数,用于操作数组中的每个元素,它可接受四个参数: -
-
accumulator
-
累加器:上一次调用回调函数时,回调函数返回的值。首次调用回调函数时,如果 initialValue 存在,累加器即为 initialValue,否则须为数组中的最后一个元素(详见下方 initialValue 处相关说明)。
-
currentValue
-
当前元素:当前被处理的元素。
-
index{{optional_inline}}
-
数组中当前被处理的元素的索引。
-
array{{optional_inline}}
-
调用 reduceRight() 的数组。
-
+
+
accumulator
+
累加器:上一次调用回调函数时,回调函数返回的值。首次调用回调函数时,如果 initialValue 存在,累加器即为 initialValue,否则须为数组中的最后一个元素(详见下方 initialValue 处相关说明)。
+
currentValue
+
当前元素:当前被处理的元素。
+
index{{optional_inline}}
+
数组中当前被处理的元素的索引。
+
array{{optional_inline}}
+
调用 reduceRight() 的数组。
+
initialValue{{optional_inline}} 
首次调用 callback 函数时,累加器 accumulator 的值。如果未提供该初始值,则将使用数组中的最后一个元素,并跳过该元素。如果不给出初始值,则需保证数组不为空。
否则,在空数组上调用 reducereduceRight 且未提供初始值(例如 [].reduce( (acc, cur, idx, arr) => {} ) )的话,会导致类型错误 TypeError: reduce of empty array with no initial value
-
-

返回值

-
-
-

执行之后的返回值。

-
+

返回值

+ +

执行之后的返回值。

+

描述

reduceRight 为数组中每个元素调用一次 callback 回调函数,但是数组中被删除的索引或从未被赋值的索引会跳过。回调函数接受四个参数:初始值(或上次调用回调的返回值)、当前元素值、当前索引,以及调用迭代的当前数组。

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html index b20d27f664..2d44c8dc8d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/slice/index.html @@ -58,8 +58,8 @@ var citrus = fruits.slice(1, 3); // citrus contains ['Orange','Lemon']
-
-

译者注:citrus [n.] 柑橘类果实

+
+

标注: citrus [n.] 柑橘类果实——译注

使用 slice

diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html index a0f5695dfb..7d5102b182 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/some/index.html @@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Array/some

some() 方法测试数组中是不是至少有1个元素通过了被提供的函数测试。它返回的是一个Boolean类型的值。

-

注意:如果用一个空数组进行测试,在任何情况下它返回的都是false

+

备注:如果用一个空数组进行测试,在任何情况下它返回的都是false

{{EmbedInteractiveExample("pages/js/array-some.html")}}
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/sort/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/sort/index.html index 49a4339d87..51bb55254e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/array/sort/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/array/sort/index.html @@ -100,7 +100,7 @@ console.log(numbers);

对象可以按照某个属性排序:

-
var items = [
+
var items = [
   { name: 'Edward', value: 21 },
   { name: 'Sharpe', value: 37 },
   { name: 'And', value: 45 },
diff --git a/files/zh-cn/web/javascript/reference/global_objects/array/values/index.html b/files/zh-cn/web/javascript/reference/global_objects/array/values/index.html
index 92e3920d88..cbfc745614 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/array/values/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/array/values/index.html
@@ -53,8 +53,8 @@ iterator.next();               // Object { value: "e", done: false }
 iterator.next();               // Object { value: undefined, done: true }
 iterator.next().value;         // undefined
-
-

一次性:数组迭代器是一次性的,或者说临时对象

+
+

警告:一次性:数组迭代器是一次性的,或者说临时对象

例子:

@@ -80,8 +80,8 @@ arr[1] = 'n'; iterator.next().value; // "n"
-
-

如果数组中元素改变,那么迭代器的值也会改变

+
+

备注:如果数组中元素改变,那么迭代器的值也会改变

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/asyncfunction/index.html b/files/zh-cn/web/javascript/reference/global_objects/asyncfunction/index.html index da8987cdfd..58e175eb9b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/asyncfunction/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/asyncfunction/index.html @@ -39,7 +39,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/AsyncFunction

传递给 AsyncFunction 构造函数的所有参数,都会成为新函数中的变量,变量的名称和定义顺序与各参数相同。 

-

注意:使用 AsyncFunction 构造函数创建的{{jsxref("Statements/async_function", "异步函数")}} 并不会在当前上下文中创建闭包,其作用域始终是全局的。因此运行的时候只能访问它们自己的本地变量和全局变量,但不能访问构造函数被调用的那个作用域中的变量。这是它与 {{jsxref("Global_Objects/eval", "eval")}} 不同的地方。

+

备注: AsyncFunction 构造函数创建的{{jsxref("Statements/async_function", "异步函数")}} 并不会在当前上下文中创建闭包,其作用域始终是全局的。因此运行的时候只能访问它们自己的本地变量和全局变量,但不能访问构造函数被调用的那个作用域中的变量。这是它与 {{jsxref("Global_Objects/eval", "eval")}} 不同的地方。

调用 AsyncFunction 构造函数时可以省略 new,其效果是一样的。

diff --git a/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html b/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html index 6459625463..7682af0a7b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/atomics/notify/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/notify

静态方法 Atomics.notify() 提醒一些在等待队列中休眠的代理。

-

注意:本操作仅在共享的 {{jsxref("Int32Array")}} 下可用。

+

备注:本操作仅在共享的 {{jsxref("Int32Array")}} 下可用。

语法

diff --git a/files/zh-cn/web/javascript/reference/global_objects/atomics/wait/index.html b/files/zh-cn/web/javascript/reference/global_objects/atomics/wait/index.html index 14696990a1..ab56ef2512 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/atomics/wait/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/atomics/wait/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/wait

静态方法 Atomics.wait() 确保了一个在 {{jsxref("Int32Array")}} 数组中给定位置的值没有发生变化、仍然是给定的值时进程将会睡眠,直到被唤醒或超时。该方法返回一个字符串,值为"ok", "not-equal", 或 "timed-out" 之一。

-

注意: 这项操作仅允许同一个共享内存的 {{jsxref("Int32Array")}} 配合使用并且无法运行在主线程中。

+

备注:这项操作仅允许同一个共享内存的 {{jsxref("Int32Array")}} 配合使用并且无法运行在主线程中。

语法

diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint/bigint/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint/bigint/index.html index 7e7a2923f6..cec0e705b2 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/bigint/bigint/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/bigint/bigint/index.html @@ -19,8 +19,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt/BigInt
被创建的对象的数值。 可以是字符串或整数。
-
-

Note: BigInt() 不与 {{JSxRef("Operators/new", "new")}} 运算符一起使用。

+
+

备注:: BigInt() 不与 {{JSxRef("Operators/new", "new")}} 运算符一起使用。

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html index 9e52874364..1ac067ad98 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/bigint/index.html @@ -72,8 +72,8 @@ bigN * -1n

/ 操作符对于整数的运算也没问题。可是因为这些变量是 BigInt 而不是 BigDecimal ,该操作符结果会向零取整,也就是说不会返回小数部分。

-
-

当使用 BigInt 时,带小数的运算会被取整。

+
+

警告:当使用 BigInt 时,带小数的运算会被取整。

const expected = 4n / 2n;
diff --git a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html
index c056ac16eb..48f1d2adfc 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/bigint64array/index.html
@@ -13,22 +13,17 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt64Array
 
 

BigInt64Array()

-

     添加一个新的BigInt64Array对象。

+

添加一个新的BigInt64Array对象。

静态属性

{{jsxref("TypedArray.BYTES_PER_ELEMENT", "BigInt64Array.BYTES_PER_ELEMENT")}}
-
- -

   返回一个元素大小的数字值,BigInt64Array返回 8

- -
+
返回一个元素大小的数字值,BigInt64Array返回 8
{{jsxref("TypedArray.name", "BigInt64Array.name")}}
+
返回构造函数名字的字符串值,如果是BigInt64Array 的话,就是"BigInt64Array".
-

   返回构造函数名字的字符串值,如果是BigInt64Array 的话,就是"BigInt64Array".

-

实例属性

@@ -39,8 +34,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt64Array
{{jsxref("TypedArray.prototype.byteOffset", "BigInt64Array.prototype.byteOffset")}}
返回 BigInt64Array 从{jsxref(“ArrayBuffer”)}}开始的偏移量(以字节为单位)。这在构造时已被固定的,因此是只读。
{{jsxref("TypedArray.prototype.length", "BigInt64Array.prototype.length")}}
-
                 -

返回 BigInt64Array 中被 保留的元 素个数。这  在构造时是固定的,因此是只读 。  

+
+

返回 BigInt64Array 中被保留的元素个数。这在构造时是固定的,因此是只读。

@@ -54,13 +49,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/BigInt64Array
{{jsxref("TypedArray.every", "BigInt64Array.prototype.every()")}}
测试数组中的所有元素是否通过函数提供的测试。另请参见{jsxref(“Array.prototype.every()")}}.
{{jsxref("TypedArray.fill", "BigInt64Array.prototype.fill()")}}
-
-
-
-
用静态值填充从起始索引到结束索引的数组的所有元素。另请参见{jsxref(“Array.prototype.fill()")}}
-
-
-
+
用静态值填充从起始索引到结束索引的数组的所有元素。另请参见{jsxref(“Array.prototype.fill()")}}
{{jsxref("TypedArray.filter", "BigInt64Array.prototype.filter()")}}
使用提供的筛选函数为其返回true的数组的所有元素创建一个新数组。另请参见{jsxref(“Array.prototype.filter()")}}
{{jsxref("TypedArray.find", "BigInt64Array.prototype.find()")}}
diff --git a/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html b/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html index 4101843056..51e5f1bef8 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/boolean/index.html @@ -50,8 +50,8 @@ var s = new Boolean(myString); // true

最后,不要在应该使用基本类型布尔值的地方使用 Boolean 对象。

-
-

注意:当将非标准属性document.all用作此构造函数的参数时,结果是值为false的布尔对象。 此属性是旧属性,是非标准属性,不应使用。

+
+

备注:当将非标准属性document.all用作此构造函数的参数时,结果是值为false的布尔对象。 此属性是旧属性,是非标准属性,不应使用。

构造器

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat32/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat32/index.html index b43d4df38c..8d6ac933cf 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat32/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat32/index.html @@ -29,9 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getFloat32

返回

-
-
一个带符号的32位浮点数。
-
+

一个带符号的32位浮点数。

抛出错误

@@ -42,9 +40,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getFloat32

说明

-
-
没有对齐约束; 多字节值可以从任何偏移处获取。
-
+

没有对齐约束; 多字节值可以从任何偏移处获取。

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat64/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat64/index.html index 885acb9421..f6e9ec4c7d 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat64/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getfloat64/index.html @@ -26,9 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getFloat64

返回

-
-
一个双精度浮点型64位数.
-
+

一个双精度浮点型64位数.

抛出错误

@@ -39,9 +37,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getFloat64

描述

-
-
没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint16/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint16/index.html index 060f88b722..eefe63841f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint16/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint16/index.html @@ -29,9 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getInt16

返回

-
-
一个短整型16位数.
-
+

一个短整型16位数.

抛出错误

@@ -42,9 +40,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getInt16

描述

-
-
 没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

 没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint32/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint32/index.html index 616d2b1977..d9bb1e5136 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint32/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint32/index.html @@ -26,9 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getInt32

返回

-
-
一个长整型32位数.
-
+

一个长整型32位数.

抛出错误

@@ -39,9 +37,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getInt32

描述

-
-
 没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

 没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint8/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint8/index.html index 0a8a5da6a2..2de057b837 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getint8/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getint8/index.html @@ -34,9 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getInt8

描述

-
-
 没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

 没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint16/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint16/index.html index 6ed5b252da..3b7d2e5c56 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint16/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint16/index.html @@ -29,9 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint16

返回

-
-
一个无符号短整型16位数.
-
+

一个无符号短整型16位数.

抛出错误

@@ -42,9 +40,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint16

描述

-
-
没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint32/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint32/index.html index 3affb0312a..8287ff8463 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint32/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint32/index.html @@ -26,9 +26,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint32

返回

-
-
一个无符号长整型32位数.
-
+

一个无符号长整型32位数.

抛出错误

@@ -39,9 +37,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint32

描述

-
-
没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint8/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint8/index.html index 4e26ade311..0d12718d1c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint8/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/getuint8/index.html @@ -34,9 +34,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getUint8

描述

-
-
 没有对齐约束; 多字节值可以从任何偏移量获取.
-
+

 没有对齐约束; 多字节值可以从任何偏移量获取.

例子

diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/setint8/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/setint8/index.html index dc7c7b30e4..7938a2183a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/dataview/setint8/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/setint8/index.html @@ -22,13 +22,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/DataView/setInt8
偏移量,从头开始计算,单位为字节
value
设置的整数值
-
-

返回

- -

{{jsxref("undefined")}}.

-
+

返回

+ +

{{jsxref("undefined")}}.

+

抛出的错误

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/date/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/date/index.html index f97d377482..bc5f87a4aa 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/date/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/date/index.html @@ -19,8 +19,8 @@ new Date(dateString) new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]])
-
-

Note: The only correct way to instantiate a new Date object is by using the {{jsxref("new")}} operator. If you simply call the Date object directly, such as now = Date(), the returned value is a string rather than a Date object.

+
+

备注: The only correct way to instantiate a new Date object is by using the {{jsxref("new")}} operator. If you simply call the Date object directly, such as now = Date(), the returned value is a string rather than a Date object.

Parameters

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html index 7e7e429c3d..0e86ba5d6e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getdate/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate

语法

-
dateObj.getDate()
+
dateObj.getDate()

参数

@@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate

下面第二条语句将值25赋给 day 变量,该值基于日期对象 Xmax95的值。

-
var Xmas95 = new Date("December 25, 1995 23:15:00");
+
var Xmas95 = new Date("December 25, 1995 23:15:00");
 var day = Xmas95.getDate();
 
 alert(day); // 25
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html index cc3a17b6c4..e299df4666 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay

语法

-
dateObj.getDay()
+
dateObj.getDay()
 

返回值

@@ -26,13 +26,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay

下面第二条语句,基于{{jsxref("Date")}}对象 Xmas95 的值,把 1 赋值给 weekday。也就是说1995年12月25日是星期一。

-
var Xmas95 = new Date("December 25, 1995 23:15:30");
+
var Xmas95 = new Date("December 25, 1995 23:15:30");
 var weekday = Xmas95.getDay();
 
 console.log(weekday); // 1
-
-

注意:如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}与一个额外的options 参数,从而返回这天的全称(如"Monday").使用此方法,结果会更加国际化:

+
+

备注:如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}与一个额外的options 参数,从而返回这天的全称(如"Monday").使用此方法,结果会更加国际化:

var options = { weekday: 'long'};
 console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html
index 2046e96d75..abd1ea2fd4 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/date/gethours/index.html
@@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours
 
 

语法

-
dateObj.getHours()
+
dateObj.getHours()

参数

@@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getHours

下面第二条语句,基于日期对象 Xmas95 的值,把 23 赋值给了变量 hours。

-
var Xmas95 = new Date("December 25, 1995 23:15:00");
+
var Xmas95 = new Date("December 25, 1995 23:15:00");
 var hours = Xmas95.getHours();
 
 alert(hours); // 23
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html index 231cf2d7f9..40b3ac6eb5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmilliseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds

语法

-
dateObj.getMilliseconds()
+
dateObj.getMilliseconds()

参数

@@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMilliseconds

下例中,将当前时间的毫秒数赋值给变量 ms

-
var ms;
+
var ms;
 Today = new Date();
 ms = Today.getMilliseconds();
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html index 27adb1a179..7ebdff046e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getminutes/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes

语法

-
dateObj.getMinutes()
+
dateObj.getMinutes()

参数

@@ -27,7 +27,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMinutes

下例中,第二行语句运行过后,变量 minutes 的值为15,也就是说 Xmas95 这个日期对象的值为某时15分某秒。

-
var Xmas95 = new Date("December 25, 1995 23:15:00");
+
var Xmas95 = new Date("December 25, 1995 23:15:00");
 var minutes = Xmas95.getMinutes();

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html index ce008a4ba0..f4baba5270 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getmonth/index.html @@ -20,7 +20,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMonth

语法

-
dateObj.getMonth()
+
dateObj.getMonth()

参数

@@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getMonth

下面第二条语句,基于 {{jsxref("Date")}} 对象 Xmas95 的值,把11赋值给变量 month。

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var month = Xmas95.getMonth();
 
 console.log(month); // 11
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html index 4543e5c2b2..dbd4590d22 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getseconds/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds

语法

-
dateObj.getSeconds()
+
dateObj.getSeconds()

参数

@@ -29,13 +29,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds

下面第二条语句,基于日期对象 Xmas95 的值,把 30 赋值给变量 secs

-
var Xmas95 = new Date("December 25, 1995 23:15:30");
+
var Xmas95 = new Date("December 25, 1995 23:15:30");
 var secs = Xmas95.getSeconds();
-
 
- -
 
-

规范

属性/元素 - 说明 - 示例 + 属性/元素 + 说明 + 示例
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html index 7f2d81f94e..f85174cd35 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

语法

-
dateObj.getTimezoneOffset()
+
dateObj.getTimezoneOffset()

参数

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/index.html index d7dd9f80b5..19b33d4de4 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/index.html @@ -24,7 +24,7 @@ new Date(dateString); new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]);
-

创建一个新Date对象的唯一方法是通过{{jsxref("Operators/new", "new")}} 操作符,例如:let now = new Date();
+

备注:创建一个新Date对象的唯一方法是通过{{jsxref("Operators/new", "new")}} 操作符,例如:let now = new Date();
若将它作为常规函数调用(即不加 {{jsxref("Operators/new", "new")}} 操作符),将返回一个字符串,而非 Date 对象。 

@@ -41,10 +41,10 @@ new Date(year, monthIndex [, day [, hours<
value
一个 Unix 时间戳(Unix Time Stamp),它是一个整数值,表示自1970年1月1日00:00:00 UTC(the Unix epoch)以来的毫秒数,忽略了闰秒。请注意大多数 Unix 时间戳功能仅精确到最接近的秒。
-

时间戳字符串

dateString
+
时间戳字符串 dateString
表示日期的字符串值。该字符串应该能被 {{jsxref("Date.parse()")}} 正确方法识别(即符合 IETF-compliant RFC 2822 timestamps 或 version of ISO8601)。
-

注意: 由于浏览器之间的差异与不一致性,强烈不推荐使用Date构造函数来解析日期字符串 (或使用与其等价的Date.parse)。对 RFC 2822 格式的日期仅有约定俗成的支持。 对 ISO 8601 格式的支持中,仅有日期的串 (例如 "1970-01-01") 会被处理为 UTC 而不是本地时间,与其他格式的串的处理不同。

+

备注:由于浏览器之间的差异与不一致性,强烈不推荐使用Date构造函数来解析日期字符串 (或使用与其等价的Date.parse)。对 RFC 2822 格式的日期仅有约定俗成的支持。 对 ISO 8601 格式的支持中,仅有日期的串 (例如 "1970-01-01") 会被处理为 UTC 而不是本地时间,与其他格式的串的处理不同。

@@ -73,15 +73,15 @@ new Date(year, monthIndex [, day [, hours<

使用注释

-

注意 参数monthIndex 是从“0”开始计算的,这就意味着一月份为“0”,十二月份为“11”。

+

备注:参数monthIndex 是从“0”开始计算的,这就意味着一月份为“0”,十二月份为“11”。

-

注意:当Date作为构造函数调用并传入多个参数时,如果数值大于合理范围时(如月份为 13 或者分钟数为 70),相邻的数值会被调整。比如 new Date(2013, 13, 1)等于new Date(2014, 1, 1),它们都表示日期2014-02-01(注意月份是从0开始的)。其他数值也是类似,new Date(2013, 2, 1, 0, 70)等于new Date(2013, 2, 1, 1, 10),都表示同一个时间:2013-03-01T01:10:00

+

备注:当Date作为构造函数调用并传入多个参数时,如果数值大于合理范围时(如月份为 13 或者分钟数为 70),相邻的数值会被调整。比如 new Date(2013, 13, 1)等于new Date(2014, 1, 1),它们都表示日期2014-02-01(注意月份是从0开始的)。其他数值也是类似,new Date(2013, 2, 1, 0, 70)等于new Date(2013, 2, 1, 1, 10),都表示同一个时间:2013-03-01T01:10:00

-

注意:当Date作为构造函数调用并传入多个参数时,所定义参数代表的是当地时间。如果需要使用世界协调时 UTC,使用 new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}}) 和相同参数。

+

备注:当Date作为构造函数调用并传入多个参数时,所定义参数代表的是当地时间。如果需要使用世界协调时 UTC,使用 new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}}) 和相同参数。

简介

@@ -112,7 +112,7 @@ new Date(year, monthIndex [, day [, hours<
{{jsxref("Date.parse()")}}
解析一个表示日期的字符串,并返回从 1970-1-1 00:00:00 所经过的毫秒数。
-

注意: 由于浏览器差异和不一致,强烈建议不要使用Date.parse解析字符串。

+

备注: 由于浏览器差异和不一致,强烈建议不要使用Date.parse解析字符串。

{{jsxref("Date.UTC()")}}
@@ -141,7 +141,7 @@ new Date(year, monthIndex [, day [, hours<

下例展示了用来创建一个日期对象的多种方法。

-

注意: 由于浏览器差异和不一致性,强烈建议不要使用Date构造函数(和Date.parse,它们是等效的)解析日期字符串。

+

备注: 由于浏览器差异和不一致性,强烈建议不要使用Date构造函数(和Date.parse,它们是等效的)解析日期字符串。

var today = new Date();
@@ -197,7 +197,7 @@ yourFunctionReturn = printElapsedTime(yourFunction);
 
-

注意:在支持 {{domxref("window.performance", "Web Performance API")}} 的高精细度(high-resolution)时间功能的浏览器中,{{domxref("Performance.now()")}} 提供的所经过的时间比 {{jsxref("Date.now()")}} 更加可靠、精确。

+

备注:在支持 {{domxref("window.performance", "Web Performance API")}} 的高精细度(high-resolution)时间功能的浏览器中,{{domxref("Performance.now()")}} 提供的所经过的时间比 {{jsxref("Date.now()")}} 更加可靠、精确。

获取自 Unix 起始时间以来经过的秒数

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/parse/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/parse/index.html index eef2f86594..d479715f29 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/parse/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/parse/index.html @@ -38,9 +38,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/parse

返回值

-
-
一个表示从1970-1-1 00:00:00 UTC到给定日期字符串所表示时间的毫秒数的数值。如果参数不能解析为一个有效的日期,则返回{{jsxref("NaN")}}。
-
+

一个表示从1970-1-1 00:00:00 UTC到给定日期字符串所表示时间的毫秒数的数值。如果参数不能解析为一个有效的日期,则返回{{jsxref("NaN")}}。

描述

@@ -70,22 +68,22 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/parse

但是, 在如 ECMA-262 规范中定义的情况,如果因为无效值而导致日期字符串不能被识别为 ISO 格式时,根据浏览器和给定的值不同,返回值可以是,也可以不是 {{jsxref("NaN")}} 。比如:

-
// 包含无效值的非 ISO 格式字符串
+
// 包含无效值的非 ISO 格式字符串
 new Date('23/25/2014');

在 Firefox 30 中会被识别为本地时区的2015年12月25日,而在 Safari 7 中则是无效日期。但是,如果字符串被识别为 ISO 格式并且包含无效值,则在所有遵循 ES5 或者更新标准的浏览器中都会返回 {{jsxref("NaN")}} 。

-
// 包含无效值的 ISO 格式字符串
+
// 包含无效值的 ISO 格式字符串
 new Date('2014-25-23').toISOString();
 // 在所有遵循 ES5的浏览器中返回 "RangeError: invalid date"

SpiderMonkey 的引擎策略可以在 jsdate.cpp  中找到。字符串 "10 06 2014"  可以作为非 ISO 格式字符串使用自定义处理方式的例子。参见这篇关于解析如何进行的粗略纲要

-
new Date('10 06 2014');
+
new Date('10 06 2014');

将会被解析为本地时间 2014年10月6日,而不是6月10日。另一个例子

-
new Date('foo-bar 2014').toString();
+
new Date('foo-bar 2014').toString();
 // 返回: "Invalid Date"
 
 Date.parse('foo-bar 2014');
@@ -97,7 +95,7 @@ Date.parse('foo-bar 2014');
 
 

如果 IPOdate 是一个已经存在的 {{jsxref("Date")}} 对象,则可以把其设置为本地时间 1995年8月9日。如下:

-
IPOdate.setTime(Date.parse('Aug 9, 1995'));
+
IPOdate.setTime(Date.parse('Aug 9, 1995'));

其他一些解析非标准格式日期的例子:

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html index 5c85e43084..b2393680ba 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/setfullyear/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear

语法

-
dateObj.setFullYear(yearValue[, monthValue[, dayValue]])
+
dateObj.setFullYear(yearValue[, monthValue[, dayValue]])

参数

@@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setFullYear

例子:使用setFullYear方法

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setFullYear(1997);

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/settime/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/settime/index.html index ef3ce60645..28e6aee649 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/settime/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/settime/index.html @@ -20,12 +20,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/setTime
timeValue
一个整数,表示从1970-1-1 00:00:00 UTC开始计时的毫秒数。
-
-

返回值

-
-
UTC 1970年1月1日00:00:00与更新日期之间的毫秒数(实际上是自变量的值)。
+

返回值

+

UTC 1970年1月1日00:00:00与更新日期之间的毫秒数(实际上是自变量的值)。

+

描述

使用 setTime 方法用来把一个日期时间赋值给另一个 Date 对象。

diff --git a/files/zh-cn/web/javascript/reference/global_objects/decodeuricomponent/index.html b/files/zh-cn/web/javascript/reference/global_objects/decodeuricomponent/index.html index 7db77bdbf1..7857abb575 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/decodeuricomponent/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/decodeuricomponent/index.html @@ -55,87 +55,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/decodeURIComponent

规范

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
规范状态备注
{{SpecName('ES3')}}{{Spec2('ES3')}}初始定义
{{SpecName('ES5.1', '#sec-15.1.3.2', 'decodeURIComponent')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-decodeuricomponent-encodeduricomponent', 'decodeURIComponent')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-decodeuricomponent-encodeduricomponent', 'decodeURIComponent')}}{{Spec2('ESDraft')}} 
+{{Specifications}}

浏览器兼容性

-

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - -
特性ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基础功能{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
特性AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基础功能{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/encodeuri/index.html b/files/zh-cn/web/javascript/reference/global_objects/encodeuri/index.html index 1bb8380c20..1a54a66c42 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/encodeuri/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/encodeuri/index.html @@ -22,13 +22,12 @@ translation_of: Web/JavaScript/Reference/Global_Objects/encodeURI
URI
一个完整的URI.
-
-

返回值

- -

    一个新字符串, 表示提供的字符串编码为统一资源标识符 (URI)。

-
+

返回值

+ +

    一个新字符串, 表示提供的字符串编码为统一资源标识符 (URI)。

+

描述

假定一个URI是完整的URI,那么无需对那些保留的并且在URI中有特殊意思的字符进行编码。

@@ -40,8 +39,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/encodeURI - - + + @@ -79,87 +78,11 @@ console.log(encodeURI('\uDFFF'));

规范

-
类型包含类型包含
保留字符
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
规范状态备注
{{SpecName('ES3')}}{{Spec2('ES3')}}初始定义
{{SpecName('ES5.1', '#sec-15.1.3.3', 'encodeURI')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-encodeuri-uri', 'encodeURI')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-encodeuri-uri', 'encodeURI')}}{{Spec2('ESDraft')}} 
+{{Specifications}}

浏览器兼容性

-

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
特性ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基础功能{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
特性AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基础功能{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/columnnumber/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/columnnumber/index.html index e1e1161fbd..a39fa3b734 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/columnnumber/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/columnnumber/index.html @@ -18,59 +18,11 @@ console.log(e.columnNumber) // 0

规范

-

不属于任何规范的一部分. 非标准.

+{{Specifications}}

浏览器兼容性

-
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本支持{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本支持{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/filename/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/filename/index.html index 2ef563d050..8e679effa2 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/filename/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/filename/index.html @@ -22,59 +22,11 @@ throw e;

规范

-

不属于任何规范的一部分. 非标准.

+{{Specifications}} -

Browser compatibility

+

浏览器兼容性

-
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本支持{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本支持{{CompatNo}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/index.html index 80da68f766..2717020571 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/index.html @@ -121,7 +121,7 @@ const y = new Error('I was constructed via the "new" keyword!');

你可能希望自定义基于Error的异常类型,使得你能够 throw new MyError() 并可以使用 instanceof MyError 来检查某个异常的类型. 这种需求的通用解决方法如下.

-

注意,在FireFox中抛出自定义类型的异常会显示不正确的行号和文件名。

+

警告:注意,在FireFox中抛出自定义类型的异常会显示不正确的行号和文件名。

参考 "What's a good way to extend Error in JavaScript?" discussion on Stackoverflow.

@@ -149,48 +149,6 @@ try { console.log(e.message); // 'custom message' } -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/message/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/message/index.html index ff4dce9d23..7979ed0998 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/message/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/message/index.html @@ -25,82 +25,11 @@ throw e;

规范

-
- - - - - - - - - - - - - - - - - - - - - - -
规范版本规范状态注解
ECMAScript 1st Edition.StandardInitial definition.
{{SpecName('ES5.1', '#sec-15.11.4.3', 'Error.prototype.message')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-error.prototype.message', 'Error.prototype.message')}}{{Spec2('ES6')}} 
+{{Specifications}}

浏览器兼容性

-

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html index 80848f54dc..e60689f3e9 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/name/index.html @@ -25,82 +25,11 @@ throw e; // "ParseError: Malformed input"

规范

- - - - - - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
ECMAScript 1st Edition.StandardInitial definition.
{{SpecName('ES5.1', '#sec-15.11.4.2', 'Error.prototype.name')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-error.prototype.name', 'Error.prototype.name')}}{{Spec2('ES6')}} 
+{{Specifications}}

浏览器兼容性

-
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
+{{Compat}}

相关链接

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/tosource/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/tosource/index.html index f6d59df24d..cc7a12d0de 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/tosource/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/tosource/index.html @@ -25,7 +25,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Error/toSource

这些属性对应于错误实例的相应属性。

-

提示:  需要注意到,在创建该字符串时,toSource方法所使用的属性是可变的,并且可能无法准确地反映用于创建错误实例的函数或实际发生错误的文件名或行号。

+

备注:  需要注意到,在创建该字符串时,toSource方法所使用的属性是可变的,并且可能无法准确地反映用于创建错误实例的函数或实际发生错误的文件名或行号。

规范

diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/tostring/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/tostring/index.html index 395d61aee2..2dfc20c937 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/tostring/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/tostring/index.html @@ -49,80 +49,15 @@ print(e.toString()); // "Error" e.name = "hello"; print(e.toString()); // "hello" +

规范

- - - - - - - - - - - - - - - - - - - - - - - -
规范版本规范状态注解
ECMAScript 1st Edition.StandardInitial definition.
- Implemented in JavaScript 1.1
{{SpecName('ES5.1', '#sec-15.11.4.4', 'Error.prototype.toString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-error.prototype.tostring', 'Error.prototype.toString')}}{{Spec2('ES6')}} 
+ +{{Specifications}} +

浏览器兼容性

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
-
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}{{ CompatVersionUnknown() }}
-
+ +{{Compat}} +

相关链接