aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/javascript/reference
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
commit218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch)
treea9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/zh-tw/web/javascript/reference
parent074785cea106179cb3305637055ab0a009ca74f2 (diff)
downloadtranslated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip
initial commit
Diffstat (limited to 'files/zh-tw/web/javascript/reference')
-rw-r--r--files/zh-tw/web/javascript/reference/classes/constructor/index.html157
-rw-r--r--files/zh-tw/web/javascript/reference/classes/extends/index.html108
-rw-r--r--files/zh-tw/web/javascript/reference/classes/index.html362
-rw-r--r--files/zh-tw/web/javascript/reference/classes/static/index.html123
-rw-r--r--files/zh-tw/web/javascript/reference/errors/bad_return_or_yield/index.html51
-rw-r--r--files/zh-tw/web/javascript/reference/errors/index.html22
-rw-r--r--files/zh-tw/web/javascript/reference/errors/invalid_array_length/index.html74
-rw-r--r--files/zh-tw/web/javascript/reference/errors/missing_curly_after_property_list/index.html47
-rw-r--r--files/zh-tw/web/javascript/reference/errors/no_properties/index.html36
-rw-r--r--files/zh-tw/web/javascript/reference/errors/not_a_function/index.html80
-rw-r--r--files/zh-tw/web/javascript/reference/errors/not_defined/index.html67
-rw-r--r--files/zh-tw/web/javascript/reference/errors/redeclared_parameter/index.html57
-rw-r--r--files/zh-tw/web/javascript/reference/errors/too_much_recursion/index.html50
-rw-r--r--files/zh-tw/web/javascript/reference/errors/unexpected_type/index.html49
-rw-r--r--files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html197
-rw-r--r--files/zh-tw/web/javascript/reference/functions/arguments/index.html235
-rw-r--r--files/zh-tw/web/javascript/reference/functions/arrow_functions/index.html340
-rw-r--r--files/zh-tw/web/javascript/reference/functions/default_parameters/index.html292
-rw-r--r--files/zh-tw/web/javascript/reference/functions/get/index.html170
-rw-r--r--files/zh-tw/web/javascript/reference/functions/index.html617
-rw-r--r--files/zh-tw/web/javascript/reference/functions/method_definitions/index.html213
-rw-r--r--files/zh-tw/web/javascript/reference/functions/rest_parameters/index.html155
-rw-r--r--files/zh-tw/web/javascript/reference/functions/set/index.html138
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/@@iterator/index.html89
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html157
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html156
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/entries/index.html86
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/every/index.html191
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/fill/index.html156
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html238
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/find/index.html204
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/findindex/index.html181
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/flat/index.html148
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html297
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/from/index.html215
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/includes/index.html175
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/index.html457
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html260
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html134
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/join/index.html109
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/keys/index.html76
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/lastindexof/index.html168
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/length/index.html131
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/map/index.html320
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/of/index.html98
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/pop/index.html98
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/push/index.html143
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html472
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html90
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/shift/index.html114
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html242
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/some/index.html217
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html248
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html150
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/unshift/index.html101
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/array/values/index.html77
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html225
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html110
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html118
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/bigint/index.html279
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/boolean/index.html199
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/dataview/index.html173
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html72
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/date/index.html263
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/date/now/index.html123
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html245
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html157
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html81
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/error/index.html233
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html260
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html321
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/call/index.html105
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/index.html191
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/length/index.html144
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html138
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/index.html201
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/infinity/index.html76
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/isnan/index.html183
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/json/index.html206
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html170
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html280
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/map/index.html265
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/abs/index.html104
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/ceil/index.html170
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/floor/index.html169
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/index.html196
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/max/index.html117
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/pow/index.html107
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/random/index.html95
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/math/round/index.html212
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/nan/index.html85
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/null/index.html124
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/index.html219
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/isfinite/index.html93
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/isnan/index.html99
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html84
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html164
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/number/tofixed/index.html108
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html249
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/create/index.html258
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html224
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html380
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/freeze/index.html198
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html128
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html184
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/index.html222
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html208
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html179
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html137
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html218
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/object/watch/index.html191
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/parseint/index.html193
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/all/index.html207
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/catch/index.html189
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html102
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/index.html256
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html64
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/race/index.html171
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/reject/index.html72
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/resolve/index.html142
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html271
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/proxy/index.html400
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/rangeerror/index.html152
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/reflect/index.html130
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/regexp/index.html269
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/add/index.html83
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/clear/index.html79
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/delete/index.html98
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/entries/index.html78
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/has/index.html92
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/index.html243
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/set/values/index.html79
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/index.html328
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/match/index.html151
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html96
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html176
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html286
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/string/tolowercase/index.html77
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html268
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/undefined/index.html136
-rw-r--r--files/zh-tw/web/javascript/reference/global_objects/urierror/index.html131
-rw-r--r--files/zh-tw/web/javascript/reference/index.html300
-rw-r--r--files/zh-tw/web/javascript/reference/iteration_protocols/index.html351
-rw-r--r--files/zh-tw/web/javascript/reference/lexical_grammar/index.html548
-rw-r--r--files/zh-tw/web/javascript/reference/operators/arithmetic_operators/index.html308
-rw-r--r--files/zh-tw/web/javascript/reference/operators/async_function/index.html111
-rw-r--r--files/zh-tw/web/javascript/reference/operators/await/index.html152
-rw-r--r--files/zh-tw/web/javascript/reference/operators/bitwise_operators/index.html554
-rw-r--r--files/zh-tw/web/javascript/reference/operators/comma_operator/index.html145
-rw-r--r--files/zh-tw/web/javascript/reference/operators/comparison_operators/index.html283
-rw-r--r--files/zh-tw/web/javascript/reference/operators/conditional_operator/index.html101
-rw-r--r--files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html423
-rw-r--r--files/zh-tw/web/javascript/reference/operators/index.html301
-rw-r--r--files/zh-tw/web/javascript/reference/operators/logical_operators/index.html243
-rw-r--r--files/zh-tw/web/javascript/reference/operators/object_initializer/index.html431
-rw-r--r--files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html316
-rw-r--r--files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html195
-rw-r--r--files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html248
-rw-r--r--files/zh-tw/web/javascript/reference/operators/super/index.html179
-rw-r--r--files/zh-tw/web/javascript/reference/operators/this/index.html385
-rw-r--r--files/zh-tw/web/javascript/reference/operators/typeof/index.html177
-rw-r--r--files/zh-tw/web/javascript/reference/statements/async_function/index.html163
-rw-r--r--files/zh-tw/web/javascript/reference/statements/block/index.html86
-rw-r--r--files/zh-tw/web/javascript/reference/statements/break/index.html120
-rw-r--r--files/zh-tw/web/javascript/reference/statements/const/index.html129
-rw-r--r--files/zh-tw/web/javascript/reference/statements/debugger/index.html75
-rw-r--r--files/zh-tw/web/javascript/reference/statements/export/index.html165
-rw-r--r--files/zh-tw/web/javascript/reference/statements/for...in/index.html116
-rw-r--r--files/zh-tw/web/javascript/reference/statements/function_star_/index.html207
-rw-r--r--files/zh-tw/web/javascript/reference/statements/if...else/index.html169
-rw-r--r--files/zh-tw/web/javascript/reference/statements/import/index.html203
-rw-r--r--files/zh-tw/web/javascript/reference/statements/index.html147
-rw-r--r--files/zh-tw/web/javascript/reference/statements/label/index.html203
-rw-r--r--files/zh-tw/web/javascript/reference/statements/let/index.html246
-rw-r--r--files/zh-tw/web/javascript/reference/statements/return/index.html156
-rw-r--r--files/zh-tw/web/javascript/reference/statements/switch/index.html309
-rw-r--r--files/zh-tw/web/javascript/reference/statements/throw/index.html234
-rw-r--r--files/zh-tw/web/javascript/reference/statements/var/index.html248
-rw-r--r--files/zh-tw/web/javascript/reference/strict_mode/index.html369
-rw-r--r--files/zh-tw/web/javascript/reference/template_literals/index.html252
180 files changed, 33745 insertions, 0 deletions
diff --git a/files/zh-tw/web/javascript/reference/classes/constructor/index.html b/files/zh-tw/web/javascript/reference/classes/constructor/index.html
new file mode 100644
index 0000000000..8da81e9b71
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/classes/constructor/index.html
@@ -0,0 +1,157 @@
+---
+title: 建構子
+slug: Web/JavaScript/Reference/Classes/constructor
+translation_of: Web/JavaScript/Reference/Classes/constructor
+---
+<div>{{jsSidebar("Classes")}}</div>
+
+<p><code>constructor</code>(建構子)是個隨著 <code>class</code> 一同建立並初始化物件的特殊方法。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">constructor([arguments]) { ... }</pre>
+
+<h2 id="敘述">敘述</h2>
+
+<p>一個 class 只能有一個稱為 constructor 的特殊物件。如果一個 class 出現兩次以上的 <code>constructor</code>,就會發生 {{jsxref("SyntaxError")}} 錯誤。</p>
+
+<p>如果不指定建構子,就會使用預設的建構子。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="使用_constructor_方法">使用 <code>constructor</code> 方法</h3>
+
+<p>這段程式碼是從 <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">classes sample</a> 擷取而來。(<a href="https://googlechrome.github.io/samples/classes-es6/index.html">線上範例</a>)</p>
+
+<pre class="brush: js notranslate">class Square extends Polygon {
+ constructor(length) {
+ // 我們在這裡呼叫了 class 的建構子提供多邊形的長寬值
+ super(length, length);
+ // 注意:在 derived class 中,super() 必須在使用 this 以前被呼叫。不這樣的話會發生錯誤。
+ this.name = 'Square';
+ }
+
+ get area() {
+ return this.height * this.width;
+ }
+
+ set area(value) {
+ this.area = value;
+ }
+}</pre>
+
+<h3 id="預設的建構子">預設的建構子</h3>
+
+<p>如上文所說:如果不指定建構子,就會使用預設的建構子。對 base classes 而言,預設的建構子長得像這樣:</p>
+
+<pre class="brush: js notranslate">constructor() {}
+</pre>
+
+<p>對 derived class 而言,預設的建構子長得像這樣:</p>
+
+<pre class="brush: js notranslate">constructor(...args) {
+ super(...args);
+}</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-static-semantics-constructormethod', 'Constructor Method')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ <td>{{CompatGeckoDesktop(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>預設的建構子</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ <td>{{CompatGeckoMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ </tr>
+ <tr>
+ <td>預設的建構子</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/super">super()</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/class"><code>class</code> expression</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/class"><code>class</code> declaration</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Classes">Classes</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/classes/extends/index.html b/files/zh-tw/web/javascript/reference/classes/extends/index.html
new file mode 100644
index 0000000000..ce729e552b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/classes/extends/index.html
@@ -0,0 +1,108 @@
+---
+title: extends
+slug: Web/JavaScript/Reference/Classes/extends
+translation_of: Web/JavaScript/Reference/Classes/extends
+---
+<div>{{jsSidebar("Classes")}}</div>
+
+<p><strong><code>extends</code></strong> 關鍵字被使用於<a href="/en-US/docs/Web/JavaScript/Reference/Statements/class">類別(class)宣告</a>或<a href="/en-US/docs/Web/JavaScript/Reference/Operators/class">類別(class)表達式</a>中來建立擴展的子類別 。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/classes-extends.html", "taller")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">class ChildClass extends ParentClass { ... }
+</pre>
+
+<h2 id="解釋">解釋</h2>
+
+<p><code>extends</code> 關鍵字可用於建立一個自訂類別或內建類別的子類別。</p>
+
+<p>其繼承之原型 <code>.prototype</code> 必須是 {{jsxref("Object")}} 或 {{jsxref("null")}}。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_extends">使用 <code>extends</code></h3>
+
+<p>第一個範例是根據 <code>Polygon</code>類別建立一個名為 <code>Square</code> 的子類別。此範例提取自<a href="https://googlechrome.github.io/samples/classes-es6/index.html">線上示例</a>。</p>
+
+<pre class="brush: js">class Square extends Polygon {
+ constructor(length) {
+ // Here, it calls the parent class' constructor with lengths
+ // provided for the Polygon's width and height
+ super(length, length);
+ // Note: In derived classes, super() must be called before you
+ // can use 'this'. Leaving this out will cause a reference error.
+ this.name = 'Square';
+ }
+
+ get area() {
+ return this.height * this.width;
+ }
+}</pre>
+
+<h3 id="使用_extends_於內建類別">使用 <code>extends</code> 於內建類別</h3>
+
+<p>這個範例擴展了內建的 {{jsxref("Date")}} 類別。此範例提取自<a href="https://googlechrome.github.io/samples/classes-es6/index.html">線上範例</a>。</p>
+
+<pre class="brush: js">class myDate extends Date {
+ constructor() {
+ super();
+ }
+
+ getFormattedDate() {
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+ return this.getDate() + '-' + months[this.getMonth()] + '-' + this.getFullYear();
+ }
+}</pre>
+
+<h3 id="擴展_null">擴展 <code>null</code></h3>
+
+<p>像擴展普通類別一樣擴展 {{jsxref("null")}},但新對象的原型不會繼承 {{jsxref("Object.prototype")}}。</p>
+
+<pre class="brush: js">class nullExtends extends null {
+ constructor() {}
+}
+
+Object.getPrototypeOf(nullExtends); // Function.prototype
+Object.getPrototypeOf(nullExtends.prototype) // null
+
+new nullExtends(); //ReferenceError: this is not defined
+</pre>
+
+<h2 id="標準">標準</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-class-definitions', 'extends')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-class-definitions', 'extends')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.classes.extends")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Classes">Classes</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/super">super</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/classes/index.html b/files/zh-tw/web/javascript/reference/classes/index.html
new file mode 100644
index 0000000000..e3a62d781b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/classes/index.html
@@ -0,0 +1,362 @@
+---
+title: Classes
+slug: Web/JavaScript/Reference/Classes
+tags:
+ - Classes
+ - Constructors
+translation_of: Web/JavaScript/Reference/Classes
+---
+<div>{{JsSidebar("Classes")}}</div>
+
+<p>ECMAScript 6 中引入了類別 (class) 作為 JavaScript 現有原型程式(prototype-based)繼承的語法糖。類別語法並<strong>不是</strong>要引入新的物件導向繼承模型到 JavaScript 中,而是提供一個更簡潔的語法來建立物件和處理繼承。</p>
+
+<h2 id="定義類別">定義類別</h2>
+
+<p>類別實際上是一種特別的函數(<a href="/en-US/docs/Web/JavaScript/Reference/Functions">functions</a>),就跟你可以定義函數敘述和函數宣告一樣,類別的語法有兩個元件:類別敘述(<a href="/en-US/docs/Web/JavaScript/Reference/Operators/class">class expressions</a>)和類別宣告(<a href="/en-US/docs/Web/JavaScript/Reference/Statements/class">class declarations</a>)。</p>
+
+<h3 id="類別宣告">類別宣告</h3>
+
+<p>一個定義類別的方法是使用類別宣告(<strong>class declaration</strong>),要宣告一個類別,你要使用關鍵字 <code>class</code> 搭配類別名稱(此例為 "Polygon")。</p>
+
+<pre class="brush: js">class Polygon {
+ constructor(height, width) {
+ this.height = height;
+ this.width = width;
+ }
+}</pre>
+
+<h4 id="Hoisting">Hoisting</h4>
+
+<p><strong>函數宣告</strong>和<strong>類別宣告</strong>的一個重要差別在於函數宣告是 {{Glossary("Hoisting", "hoisted")}} ,類別宣告則不是。 你需要先宣告你的類別,然後存取它,否則像是下面的程式碼就會丟出一個 {{jsxref("ReferenceError")}}:</p>
+
+<pre class="brush: js example-bad">var p = new Polygon(); // ReferenceError
+
+class Polygon {}
+</pre>
+
+<h3 id="類別敘述">類別敘述</h3>
+
+<p><strong>類別敘述</strong>是定義類別的另一種方法。類別敘述可以有名稱或是無名稱。賦予一個有名稱類別敘述的名稱只在類別主體(class's body)中有作用。(但是類別敘述的名稱可以透過該類別(不是實例)的 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name">.name</a> 屬性存取。)</p>
+
+<pre class="brush: js">// unnamed
+var Polygon = class {
+ constructor(height, width) {
+    this.height = height;
+    this.width = width;
+ }
+};
+
+// named
+var Polygon = class Polygon {
+  constructor(height, width) {
+    this.height = height;
+    this.width = width;
+  }
+};
+
+</pre>
+
+<p>注意:類別<strong>敘述</strong>跟上述提到的類別<strong>宣告</strong>一樣,都會受到hoisting的影響。</p>
+
+<h2 id="類別主體與方法定義">類別主體與方法定義</h2>
+
+<p>類別的主體指的是被大括號(<code>{}</code>)包含的部分,你可以在這裡面定義類別成員(members),例如方法(methods)或建構子(constructors)。</p>
+
+<h3 id="Strict_mode">Strict mode</h3>
+
+<p><em>類別宣告</em>與<em>類別敘述</em>的主體都會以<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode">嚴格模式(strict mode</a>)執行,也就是說,建構子、靜態方法和原型方法、getter及setter函數等都會以嚴格模式執行。</p>
+
+<h3 id="建構子">建構子</h3>
+
+<p>建構子(<code><a href="/en-US/docs/Web/JavaScript/Reference/Classes/constructor">constructor</a>)</code>方法是一個特別的方法,用來建立和初始化一個<code>類別</code>的物件。一個類別只能有一個名為建構子(constructor)的特別方法。當類別中含有一個以上的<code>建構子</code>方法時,{{jsxref("SyntaxError")}} 將會被拋出。</p>
+
+<p>一個建構子可以用關鍵字 <code>super</code> 來呼叫父類別的建構子。</p>
+
+<h3 id="原型方法">原型方法</h3>
+
+<p>參見 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">method definitions</a>。</p>
+
+<pre class="brush: js">class Polygon {
+ constructor(height, width) {
+ this.height = height;
+ this.width = width;
+ }
+ // Getter
+  get area() {
+ return this.calcArea();
+  }
+ // Method
+  calcArea() {
+  return this.height * this.width;
+  }
+}
+
+const square = new Polygon(10, 10);
+
+console.log(square.area); //100</pre>
+
+<h3 id="靜態方法Static_methods">靜態方法(Static methods)</h3>
+
+<p>關鍵字 <code><a href="/en-US/docs/Web/JavaScript/Reference/Classes/static">static</a></code> 定義了一個類別的靜態方法,靜態方法不需要<a href="/zh-TW/docs/Learn/JavaScript/Objects">實體化</a>它所屬類別的實例就可以被呼叫,它也<strong>無法</strong>被已實體化的類別物件呼叫。靜態方法經常被用來建立給應用程式使用的工具函數。</p>
+
+<pre class="brush: js">class Point {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ static distance(a, b) {
+ const dx = a.x - b.x;
+ const dy = a.y - b.y;
+
+ return Math.sqrt(dx*dx + dy*dy);
+ }
+}
+
+const p1 = new Point(5, 5);
+const p2 = new Point(10, 10);
+
+console.log(Point.distance(p1, p2)); // 7.0710678118654755
+</pre>
+
+<h3 id="裝箱、原型方法及靜態方法">裝箱、原型方法及靜態方法</h3>
+
+<p>當一個靜態方法或原形方法被呼叫,但沒有一個物件的值與this綁定時,被呼叫的函數中this關鍵字會是<strong><code>undefined</code>。</strong>在此情況下,自動裝箱(autoboxing)不會發生<strong>。?</strong>即使我們在非嚴格模式中寫程式,此行為仍然會存在,這是因為所有的函式、定義方法、建構子、getters和setters都是在嚴格模式中執行。因此,若我們沒有定義this的值,this會是<strong><code>undefined</code></strong><code>。</code></p>
+
+<pre class="brush: js">class Animal {
+ speak() {
+ return this;
+ }
+ static eat() {
+ return this;
+ }
+}
+
+let obj = new Animal();
+obj.speak(); // Animal {}
+let speak = obj.speak;
+speak(); // undefined
+
+Animal.eat() // class Animal
+let eat = Animal.eat;
+eat(); // undefined</pre>
+
+<p>若我們將上述程式用傳統的函式基礎類別(function based classes)表達,自動裝箱則會依據this在其被呼叫的函式中所綁定的值發生。</p>
+
+<pre class="brush: js">function Animal() { }
+
+Animal.prototype.speak = function() {
+ return this;
+}
+
+Animal.eat = function() {
+ return this;
+}
+
+let obj = new Animal();
+let speak = obj.speak;
+speak(); // 全域物件
+
+let eat = Animal.eat;
+eat(); // 全域物件</pre>
+
+<h2 id="用_extends_建立子類別">用 <code>extends</code> 建立子類別</h2>
+
+<p>關鍵字 <code><a href="/en-US/docs/Web/JavaScript/Reference/Classes/extends">extends</a></code> 是在類別宣告或是類別敘述中建立子類別的方法。</p>
+
+<pre class="brush: js">class Animal {
+ constructor(name) {
+  this.name = name;
+  }
+
+  speak() {
+ console.log(this.name + ' makes a noise.');
+  }
+}
+
+class Dog extends Animal {
+ speak() {
+ console.log(this.name + ' barks.');
+  }
+}
+
+var d = new Dog('Mitzie');
+d.speak(); // Mitzie barks.
+</pre>
+
+<p>若在子類別中有建構子(constructor),要使用this前則必須先呼叫super()函式。</p>
+
+<p>你也可以擴充(extends)傳統的函式基礎"類別"。</p>
+
+<pre class="brush: js">function Animal (name) {
+ this.name = name;
+}
+
+Animal.prototype.speak = function () {
+ console.log(this.name + ' makes a noise.');
+}
+
+class Dog extends Animal {
+ speak() {
+ console.log(this.name + ' barks.');
+ }
+}
+
+var d = new Dog('Mitzie');
+d.speak(); // Mitzie barks.</pre>
+
+<p>注意類別並無法擴充一般(non-constructible不可建構的)物件。如果您想要繼承自一般的物件,可以使用{{jsxref("Object.setPrototypeOf()")}}來達成。</p>
+
+<pre class="brush: js">var Animal = {
+ speak() {
+ console.log(this.name + ' makes a noise.');
+ }
+};
+
+class Dog {
+ constructor(name) {
+ this.name = name;
+ }
+}
+
+// 如果你沒有用以下的方法,當你呼叫speak時會出現TypeError
+Object.setPrototypeOf(Dog.prototype, Animal);
+
+var d = new Dog('Mitzie');
+d.speak(); // Mitzie makes a noise.</pre>
+
+<h2 id="Species">Species</h2>
+
+<p>你可能會希望在陣列的衍生類別 <code>MyArray</code> 中回傳陣列 ({{jsxref("Array")}}) ,Species 這個模式讓你能覆寫默認的建構子 (contructor)。</p>
+
+<p>舉例來說,當你使用像 {{jsxref("Array.map", "map()")}} 這類會回傳默認建構子的方法時,你希望能回傳父物件 <code>Array</code> ,而不是 <code>MyArray</code> 物件。 {{jsxref("Symbol.species")}} 符號讓你做到這件事:</p>
+
+<pre class="brush: js">class MyArray extends Array {
+ // Overwrite species to the parent Array constructor
+ static get [Symbol.species]() { return Array; }
+}
+
+var a = new MyArray(1,2,3);
+var mapped = a.map(x =&gt; x * x);
+
+console.log(mapped instanceof MyArray); // false
+console.log(mapped instanceof Array); // true</pre>
+
+<h2 id="用_super_呼叫父類別">用 <code>super</code> 呼叫父類別</h2>
+
+<p>關鍵字 <code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/super">super</a></code> 是用來提供一個類別呼叫其父類別的函數。</p>
+
+<pre class="brush: js">class Cat {
+  constructor(name) {
+    this.name = name;
+  }
+
+  speak() {
+    console.log(this.name + ' makes a noise.');
+  }
+}
+
+class Lion extends Cat {
+  speak() {
+    super.speak();
+    console.log(this.name + ' roars.');
+  }
+}
+
+var l = new Lion('Fuzzy');
+l.speak();
+// Fuzzy makes a noise.
+// Fuzzy roars.
+</pre>
+
+<h2 id="ES5_繼承語法與_ES6_類別語法的比較">ES5 繼承語法與 ES6 類別語法的比較</h2>
+
+<p>TBD</p>
+
+<h2 id="範例">範例</h2>
+
+<p>TBD</p>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">評論</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-class-definitions', 'Class definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Edge</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(42.0)}}<sup>[1]</sup><br>
+ {{CompatChrome(49.0)}}</td>
+ <td>{{CompatGeckoDesktop(45)}}</td>
+ <td>13</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatSafari(9.0)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>9</td>
+ <td>{{CompatChrome(42.0)}}<sup>[1]</sup><br>
+ {{CompatChrome(49.0)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions">Functions</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/class"><code>class</code> declaration</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/class"><code>class</code> expression</a></li>
+ <li>{{jsxref("Operators/super", "super")}}</li>
+ <li><a href="https://hacks.mozilla.org/2015/07/es6-in-depth-classes/">Blog post: "ES6 In Depth: Classes"</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Classes/extends">extends</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/classes/static/index.html b/files/zh-tw/web/javascript/reference/classes/static/index.html
new file mode 100644
index 0000000000..49e18b44bb
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/classes/static/index.html
@@ -0,0 +1,123 @@
+---
+title: static
+slug: Web/JavaScript/Reference/Classes/static
+translation_of: Web/JavaScript/Reference/Classes/static
+---
+<div>{{jsSidebar("Classes")}}</div>
+
+<div>使用關鍵字 <strong>static </strong>來定義一個靜態的方法(method)給類別(class),靜態方法在由類別所建立的物件實體(instance)上不能被呼叫,取而代之的是,靜態方法只能由類別本身呼叫。他們通常作為工具函式(utility functions)使用。像是建立物件或複製物件的函式。</div>
+
+<div></div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">static methodName() { ... }</pre>
+
+<h2 id="敘述">敘述</h2>
+
+<p>靜態方法不須實例化(instantiating)其類別即可被呼叫,但當類別被實例化(instantiating)後則靜態方法不能被呼叫。 靜態方法常被使用在建立應用程式的工具函式(utility functions)。</p>
+
+<h2 id="範例">範例</h2>
+
+<p>下面的範例示範了許多東西。他示範了如何在一個可以有子類別的類別中實作一個靜態方法。最後示範了靜態方法在什麼情形下正確與錯誤的呼叫。</p>
+
+<pre class="brush: js">class Triple {
+ static triple(n) {
+ n = n || 1; //should not be a bitwise operation
+ return n * 3;
+ }
+}
+
+class BiggerTriple extends Triple {
+ static triple(n) {
+ return super.triple(n) * super.triple(n);
+ }
+}
+
+console.log(Triple.triple()); // 3
+console.log(Triple.triple(6)); // 18
+console.log(BiggerTriple.triple(3)); // 81
+var tp = new Triple();
+console.log(tp.triple()); // 'tp.triple is not a function'.</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-class-definitions', 'Class definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-class-definitions', 'Class definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ <td>{{CompatGeckoDesktop(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile(45)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="你可能會需要看看">你可能會需要看看</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/class"><code>class</code> expression</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/class"><code>class</code> declaration</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/bad_return_or_yield/index.html b/files/zh-tw/web/javascript/reference/errors/bad_return_or_yield/index.html
new file mode 100644
index 0000000000..7a28fb4be3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/bad_return_or_yield/index.html
@@ -0,0 +1,51 @@
+---
+title: 'SyntaxError: return not in function'
+slug: Web/JavaScript/Reference/Errors/Bad_return_or_yield
+translation_of: Web/JavaScript/Reference/Errors/Bad_return_or_yield
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">SyntaxError: return not in function
+SyntaxError: yield not in function
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/return">return</a></code> 或 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/yield">yield</a></code> 宣告在<a href="/zh-TW/docs/Web/JavaScript/Guide/Functions">函式</a>以外的地方被呼叫。也許少寫了一個大括號?<code>return</code> 與 <code>yield</code> 宣告必須要寫在函式裡面,因為它們結束(或暫停並恢復)函式的執行,並且回傳了特定值。</p>
+
+<h2 id="實例">實例</h2>
+
+<pre class="brush: js example-bad">var cheer = function(score) {
+ if (score === 147)
+ return "Maximum!";
+ };
+ if (score &gt; 100) {
+ return "Century!";
+ }
+}
+
+// SyntaxError: return not in function</pre>
+
+<p>乍看之下大括號寫對了,但其實在第一個 <code>if</code> 的後面,少了一個 <code>{</code>。正確的寫法應該是:</p>
+
+<pre class="brush: js example-good">var cheer = function(score) {
+ if (score === 147) {
+ return "Maximum!";
+ }
+ if (score &gt; 100) {
+ return "Century!";
+ }
+};</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/return">return</a></code></li>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/yield">yield</a></code></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/index.html b/files/zh-tw/web/javascript/reference/errors/index.html
new file mode 100644
index 0000000000..8f553faa75
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/index.html
@@ -0,0 +1,22 @@
+---
+title: JavaScript 錯誤參考資料
+slug: Web/JavaScript/Reference/Errors
+translation_of: Web/JavaScript/Reference/Errors
+---
+<p>{{jsSidebar("Errors")}}</p>
+
+<p>在這裡,你可以看到一些由 JavaScript 拋出的錯誤一覽。這些錯誤訊息對你的除錯很有幫助,但拋出的錯誤也不是每次都能講清楚。本頁回提供這些錯誤的詳細資訊。所有的錯誤都是由 {{jsxref("Error")}} 物件所建立的物件,有著 <code>name</code> 與 <code>message</code>。</p>
+
+<p>錯誤會出現在網路主控台、可能還連接到相應頁面,以幫助你儘速理解程式碼裡面的問題。</p>
+
+<h2 id="錯誤一覽表">錯誤一覽表</h2>
+
+<p>In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below!</p>
+
+<p>{{ListSubPages("/zh-TW/docs/Web/JavaScript/Reference/Errors")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Learn/JavaScript/First_steps/What_went_wrong">哪裡出錯了?JavaScript 除錯</a>:針對初學者的 JavaScript 除錯入門教程。</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/invalid_array_length/index.html b/files/zh-tw/web/javascript/reference/errors/invalid_array_length/index.html
new file mode 100644
index 0000000000..ee2c5f08e4
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/invalid_array_length/index.html
@@ -0,0 +1,74 @@
+---
+title: 'RangeError: invalid array length'
+slug: Web/JavaScript/Reference/Errors/Invalid_array_length
+translation_of: Web/JavaScript/Reference/Errors/Invalid_array_length
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">RangeError: Array length must be a finite positive integer (Edge)
+RangeError: invalid array length (Firefox)
+RangeError: Invalid array length (Chrome)
+RangeError: Invalid array buffer length (Chrome)
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("RangeError")}}</p>
+
+<h2 id="哪裡錯了">哪裡錯了?</h2>
+
+<p>一個無效的陣列長度可能發生於以下幾種情形:</p>
+
+<ul>
+ <li>建立了一個長度為負或大於等於2<sup>32</sup>的 {{jsxref("Array")}} 或 {{jsxref("ArrayBuffer")}} </li>
+ <li>將 {{jsxref("Array.length")}} 屬性設為負值或大於等於 2<sup>32</sup></li>
+</ul>
+
+<p>為什麼 <code>Array</code>  和 <code>ArrayBuffer</code> 的長度有限?   <code>Array</code> 和 <code>ArrayBuffer</code> 的屬性以一個32位元的非負整數表使,因此僅能儲存 0 到 2<sup>32</sup>-1 的數值。</p>
+
+<p>If you are creating an <code>Array</code>, using the constructor, you probably want to use the literal notation instead, as the first argument is interpreted as the length of the <code>Array</code>.</p>
+
+<p>Otherwise, you might want to clamp the length before setting the length property, or using it as argument of the constructor.</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="無效的案例">無效的案例</h3>
+
+<pre class="brush: js example-bad">new Array(Math.pow(2, 40))
+new Array(-1)
+new ArrayBuffer(Math.pow(2, 32))
+new ArrayBuffer(-1)
+
+let a = [];
+a.length = a.length - 1; // set -1 to the length property
+
+let b = new Array(Math.pow(2, 32) - 1);
+b.length = b.length + 1; // set 2^32 to the length property
+</pre>
+
+<h3 id="有效的案例">有效的案例</h3>
+
+<pre class="brush: js example-good">[ Math.pow(2, 40) ] // [ 1099511627776 ]
+[ -1 ] // [ -1 ]
+new ArrayBuffer(Math.pow(2, 32) - 1)
+new ArrayBuffer(0)
+
+let a = [];
+a.length = Math.max(0, a.length - 1);
+
+let b = new Array(Math.pow(2, 32) - 1);
+b.length = Math.min(0xffffffff, b.length + 1);
+
+// 0xffffffff 是 2^32 - 1 的十六進位表示
+// 也可以寫成 (-1 &gt;&gt;&gt; 0)
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("Array.length")}}</li>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/missing_curly_after_property_list/index.html b/files/zh-tw/web/javascript/reference/errors/missing_curly_after_property_list/index.html
new file mode 100644
index 0000000000..7e3728fc49
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/missing_curly_after_property_list/index.html
@@ -0,0 +1,47 @@
+---
+title: 'SyntaxError: missing } after property list'
+slug: Web/JavaScript/Reference/Errors/Missing_curly_after_property_list
+translation_of: Web/JavaScript/Reference/Errors/Missing_curly_after_property_list
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">SyntaxError: missing } after property list
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="何處出錯">何處出錯?</h2>
+
+<p>在物件初始化時,語法錯誤。  實際上可能遺漏一個大括號或是逗號。 例如, 同時檢查大括弧以及逗號是否以正確的順序關閉。 縮排或是有規則的排序代碼是有幫助您找出複雜的代碼錯誤。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="忘記逗號">忘記逗號</h3>
+
+<p>有時候,在初始化物件時,缺少一個逗號:</p>
+
+<pre class="brush: js example-bad">var obj = {
+ a: 1,
+ b: { myProp: 2 }
+ c: 3
+};
+</pre>
+
+<p>Correct would be:</p>
+
+<pre class="brush: js example-good">var obj = {
+ a: 1,
+ b: { myProp: 2 },
+ c: 3
+};
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">Object initializer</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/no_properties/index.html b/files/zh-tw/web/javascript/reference/errors/no_properties/index.html
new file mode 100644
index 0000000000..b355d15ea3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/no_properties/index.html
@@ -0,0 +1,36 @@
+---
+title: 'TypeError: "x" has no properties'
+slug: Web/JavaScript/Reference/Errors/No_properties
+translation_of: Web/JavaScript/Reference/Errors/No_properties
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">TypeError: null has no properties
+TypeError: undefined has no properties
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("TypeError")}}.</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>{{jsxref("null")}} 與 {{jsxref("undefined")}} 並沒有可訪問的屬性。</p>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js example-bad">null.foo;
+// TypeError: null has no properties
+
+undefined.bar;
+// TypeError: undefined has no properties
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("null")}}</li>
+ <li>{{jsxref("undefined")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/not_a_function/index.html b/files/zh-tw/web/javascript/reference/errors/not_a_function/index.html
new file mode 100644
index 0000000000..24ce79a6e4
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/not_a_function/index.html
@@ -0,0 +1,80 @@
+---
+title: 'TypeError: "x" is not a function'
+slug: Web/JavaScript/Reference/Errors/Not_a_function
+translation_of: Web/JavaScript/Reference/Errors/Not_a_function
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">TypeError: "x" is not a function
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("TypeError")}}.</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>你想以函式呼叫一個數值,但該數值其實不是函式。程式碼期望你給出函式,但這份期望落空了。</p>
+
+<p>也許打錯了函式的名字?也許呼叫的物件並沒有這個函式?例如說 JavaScript 物件並沒有 <code>map</code> 函式,但 JavaScript Array(陣列)物件則有。</p>
+
+<p>許多內建函式都需要回呼(callback)的函式。為了讓下面的方法順利運作,你需要為它們提供函式:</p>
+
+<ul>
+ <li>如果是 {{jsxref("Array")}} 或 {{jsxref("TypedArray")}} 物件:
+ <ul>
+ <li>{{jsxref("Array.prototype.every()")}}、{{jsxref("Array.prototype.some()")}}、{{jsxref("Array.prototype.forEach()")}}、{{jsxref("Array.prototype.map()")}}、{{jsxref("Array.prototype.filter()")}}、{{jsxref("Array.prototype.reduce()")}}、{{jsxref("Array.prototype.reduceRight()")}}、{{jsxref("Array.prototype.find()")}}</li>
+ </ul>
+ </li>
+ <li>如果是 {{jsxref("Map")}} 與 {{jsxref("Set")}} 物件:
+ <ul>
+ <li>{{jsxref("Map.prototype.forEach()")}} 與 {{jsxref("Set.prototype.forEach()")}}</li>
+ </ul>
+ </li>
+</ul>
+
+<h2 id="實例">實例</h2>
+
+<h3 id="函式的名字打錯了">函式的名字打錯了</h3>
+
+<p>這種事太常發生了。下例就有個方法打錯:</p>
+
+<pre class="brush: js example-bad">var x = document.getElementByID("foo");
+// TypeError: document.getElementByID is not a function
+</pre>
+
+<p>該函式的正確名字為 <code>getElementByI<strong>d</strong></code>:</p>
+
+<pre class="brush: js example-good">var x = document.getElementById("foo");
+</pre>
+
+<h3 id="函式呼叫到錯誤的物件">函式呼叫到錯誤的物件</h3>
+
+<p>某些方法需要你提供回呼的函式,該函式只能作用於特定物件。以本例而言,我們使用的 {{jsxref("Array.prototype.map()")}} 就只能作用於 {{jsxref("Array")}} 物件。</p>
+
+<pre class="brush: js example-bad">var obj = { a: 13, b: 37, c: 42 };
+
+obj.map(function(num) {
+ return num * 2;
+});
+
+// TypeError: obj.map is not a function</pre>
+
+<p>請改用陣列:</p>
+
+<pre class="brush: js example-good">var numbers = [1, 4, 9];
+
+numbers.map(function(num) {
+ return num * 2;
+});
+
+// Array [ 2, 8, 18 ]
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions">Functions</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/not_defined/index.html b/files/zh-tw/web/javascript/reference/errors/not_defined/index.html
new file mode 100644
index 0000000000..fa79033977
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/not_defined/index.html
@@ -0,0 +1,67 @@
+---
+title: 'ReferenceError: "x" is not defined'
+slug: Web/JavaScript/Reference/Errors/Not_defined
+translation_of: Web/JavaScript/Reference/Errors/Not_defined
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">ReferenceError: "x" is not defined
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("ReferenceError")}}.</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>有個地方參照到不存在的變數了。這個變數需要宣告、或確定在目前腳本、或在 {{Glossary("scope")}} 裡可用。</p>
+
+<div class="note">
+<p><strong>注意:</strong>如果要使用函式庫(例如 jQuery)的話,請確定在你使用諸如 $ 這樣的函式庫變數前,就已載入完畢。把載入函式庫的 {{HTMLElement("script")}} 標籤,放在你使用的程式碼之前。
+</p>
+</div>
+
+<h2 id="實例">實例</h2>
+
+<h3 id="變數未宣告">變數未宣告</h3>
+
+<pre class="brush: js example-bad">foo.substring(1); // ReferenceError: foo is not defined
+</pre>
+
+<p>"foo" 變數在任何地方都沒被定義到。它需要字串使 {{jsxref("String.prototype.substring()")}} 得以運作。</p>
+
+<pre class="brush: js example-good">var foo = "bar";
+foo.substring(1); // "ar"</pre>
+
+<h3 id="作用域錯誤">作用域錯誤</h3>
+
+<p>A variable need to be available in the current context of execution. Variables defined inside a <a href="/en-US/docs/Web/JavaScript/Reference/Functions">function</a> cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function</p>
+
+<pre class="brush: js example-bad">function numbers () {
+ var num1 = 2,
+ num2 = 3;
+ return num1 + num2;
+}
+
+console.log(num1); // ReferenceError num1 is not defined.</pre>
+
+<p>However, a function can access all variables and functions defined inside the scope in which it is defined. In other words, a function defined in the global scope can access all variables defined in the global scope.</p>
+
+<pre class="brush: js example-good">var num1 = 2,
+ num2 = 3;
+
+function numbers () {
+ return num1 + num2;
+}
+
+console.log(num1); // 2</pre>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{Glossary("Scope")}}</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_types#Declaring_variables">Declaring variables in the JavaScript Guide</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Function_scope/en-US/docs/">Function scope in the JavaScript Guide</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/redeclared_parameter/index.html b/files/zh-tw/web/javascript/reference/errors/redeclared_parameter/index.html
new file mode 100644
index 0000000000..e9ba8cbbe0
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/redeclared_parameter/index.html
@@ -0,0 +1,57 @@
+---
+title: 'SyntaxError: redeclaration of formal parameter "x"'
+slug: Web/JavaScript/Reference/Errors/Redeclared_parameter
+translation_of: Web/JavaScript/Reference/Errors/Redeclared_parameter
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">SyntaxError: redeclaration of formal parameter "x" (Firefox)
+SyntaxError: Identifier "x" has already been declared (Chrome)
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>當相同的變數名作為函式的參數、接著又在函式體(function body)內用了 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/let">let</a></code> 重複宣告並指派時出現。在 JavaScript 裡面,不允許在相同的函式、或是作用域區塊(block scope)內重複宣告相同的 <code>let</code> 變數。</p>
+
+<h2 id="實例">實例</h2>
+
+<p>在這裡,「arg」變數的參數被重複宣告。</p>
+
+<pre class="brush: js example-bad">function f(arg) {
+ let arg = 'foo';
+}
+
+// SyntaxError: redeclaration of formal parameter "arg"
+</pre>
+
+<p>If you want to change the value of "arg" in the function body, you can do so, but you do not need to declare the same variable again. In other words: you can omit the <code>let</code> keyword. If you want to create a new variable, you need to rename it as conflicts with the function parameter already.</p>
+
+<pre class="brush: js example-good">function f(arg) {
+ arg = 'foo';
+}
+
+function f(arg) {
+ let bar = 'foo';
+}
+</pre>
+
+<h2 id="相容性註解">相容性註解</h2>
+
+<ul>
+ <li>在 Firefox 49 {{geckoRelease(49)}} 之前,這個錯誤被歸為 {{jsxref("TypeError")}}。 ({{bug(1275240)}})</li>
+</ul>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/let">let</a></code></li>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/const">const</a></code></li>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/var">var</a></code></li>
+ <li>在 <a href="/zh-TW/docs/Web/JavaScript/Guide">JavaScript 教學</a>內<a href="/zh-TW/docs/Web/JavaScript/Guide/Grammar_and_Types#Declarations">宣告變數</a> </li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/too_much_recursion/index.html b/files/zh-tw/web/javascript/reference/errors/too_much_recursion/index.html
new file mode 100644
index 0000000000..1708683ffa
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/too_much_recursion/index.html
@@ -0,0 +1,50 @@
+---
+title: 'InternalError: too much recursion'
+slug: Web/JavaScript/Reference/Errors/Too_much_recursion
+translation_of: Web/JavaScript/Reference/Errors/Too_much_recursion
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="訊息">訊息</h2>
+
+<pre class="syntaxbox">InternalError: too much recursion
+</pre>
+
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("InternalError")}}</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>一個呼叫自己的函式稱為<em>遞迴函式</em>(recursive function)。在某些方面,遞迴和迴圈很像。它們都需要在指定條件(以避免無窮迴圈,或是本例的無窮遞迴)下,重複執行數次相同的程式碼。如果遞迴執行太多次、或成為無窮遞迴的話,JavaScript 就會出現這個錯誤。</p>
+
+<h2 id="實例">實例</h2>
+
+<p>以下的遞迴函式,會根據終止條件,而運行十次。</p>
+
+<pre class="brush: js">function loop(x) {
+ if (x &gt;= 10) // "x &gt;= 10" 是終止條件
+ return;
+ // do stuff
+ loop(x + 1); // 遞迴呼叫
+}
+loop(0);</pre>
+
+<p>如果把終止條件的次數設得太高,函式就不會運作了:</p>
+
+<pre class="brush: js example-bad">function loop(x) {
+ if (x &gt;= 1000000000000)
+ return;
+ // do stuff
+ loop(x + 1);
+}
+loop(0);
+
+// InternalError: too much recursion</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{Glossary("Recursion")}}</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Functions#Recursion">遞迴函式</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/errors/unexpected_type/index.html b/files/zh-tw/web/javascript/reference/errors/unexpected_type/index.html
new file mode 100644
index 0000000000..d7399baf5d
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/errors/unexpected_type/index.html
@@ -0,0 +1,49 @@
+---
+title: 'TypeError: "x" is (not) "y"'
+slug: Web/JavaScript/Reference/Errors/Unexpected_type
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_type
+---
+<h2 id="錯誤類型">錯誤類型</h2>
+
+<p>{{jsxref("TypeError")}}</p>
+
+<h2 id="哪裡錯了?">哪裡錯了?</h2>
+
+<p>有一個意想不到的類型。這與 {{jsxref("undefined")}} 或 {{jsxref("null")}} 值經常發生。</p>
+
+<p>另外,某些方法,如 {{jsxref("Object.create()")}} 或 {{jsxref("Symbol.keyFor()")}} 要求特定類型,即必須提供。</p>
+
+<h2 id="實例">實例</h2>
+
+<h3 id="無效的情況下">無效的情況下</h3>
+
+<pre class="brush: js example-bad">// undefined 和 null 的情況下在其上的子方法不起作用
+var foo = undefined;
+foo.substring(1); // TypeError: foo is undefined
+
+var foo = null;
+foo.substring(1); // TypeError: foo is null
+
+
+// 某些方法可能要求特定類型
+var foo = {}
+Symbol.keyFor(foo); // TypeError: foo is not a symbol
+
+var foo = "bar"
+Object.create(foo); // TypeError: "foo" is not an object or null
+</pre>
+
+<h3 id="修復問題">修復問題</h3>
+
+<p>為了解決空指針 <code>undefined</code> 或 <code>null</code> 值,可以使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a> 運算符,例如。 operator, for example.</p>
+
+<pre class="brush: js">if (typeof foo !== 'undefined') {
+ // 現在我們知道foo被定義,我們可以繼續進行。
+}</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("undefined")}}</li>
+ <li>{{jsxref("null")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html b/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html
new file mode 100644
index 0000000000..397eb08d00
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/arguments/callee/index.html
@@ -0,0 +1,197 @@
+---
+title: arguments.callee
+slug: Web/JavaScript/Reference/Functions/arguments/callee
+translation_of: Web/JavaScript/Reference/Functions/arguments/callee
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p>The <strong><code>arguments.callee</code></strong> property contains the currently executing function.</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>callee</code> is a property of the <code>arguments</code> object. It can be used to refer to the currently executing function inside the function body of that function. This is useful when the name of the function is unknown, such as within a function expression with no name (also called "anonymous functions").</p>
+
+<div class="warning"><strong>Warning:</strong> The 5th edition of ECMAScript (ES5) forbids use of <code>arguments.callee()</code> in <a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode">strict mode</a>. Avoid using <code>arguments.callee()</code> by either giving function expressions a name or use a function declaration where a function must call itself.</div>
+
+<h3 id="Why_was_arguments.callee_removed_from_ES5_strict_mode">Why was <code>arguments.callee</code> removed from ES5 strict mode?</h3>
+
+<p>(adapted from <a href="http://stackoverflow.com/a/235760/578288" title="http://stackoverflow.com/a/235760/578288">a Stack Overflow answer by olliej</a>)</p>
+
+<p>Early versions of JavaScript did not allow named function expressions, and for this reason you could not make a recursive function expression.</p>
+
+<p>For example, this syntax worked:</p>
+
+<pre class="brush: js">function factorial (n) {
+ return !(n &gt; 1) ? 1 : factorial(n - 1) * n;
+}
+
+[1,2,3,4,5].map(factorial);</pre>
+
+<p>but:</p>
+
+<pre class="brush: js">[1,2,3,4,5].map(function (n) {
+ return !(n &gt; 1) ? 1 : /* what goes here? */ (n - 1) * n;
+});</pre>
+
+<p>did not. To get around this <code>arguments.callee</code> was added so you could do</p>
+
+<pre class="brush: js">[1,2,3,4,5].map(function (n) {
+ return !(n &gt; 1) ? 1 : arguments.callee(n - 1) * n;
+});</pre>
+
+<p>However, this was actually a really bad solution as this (in conjunction with other <code>arguments</code>, <code>callee</code>, and <code>caller</code> issues) make inlining and tail recursion impossible in the general case (you can achieve it in select cases through tracing, etc., but even the best code is suboptimal due to checks that would not otherwise be necessary.) The other major issue is that the recursive call will get a different <code>this</code> value, e.g.:</p>
+
+<pre class="brush: js">var global = this;
+
+var sillyFunction = function (recursed) {
+ if (!recursed) { return arguments.callee(true); }
+ if (this !== global) {
+ alert("This is: " + this);
+ } else {
+ alert("This is the global");
+ }
+}
+
+sillyFunction();</pre>
+
+<p>ECMAScript 3 resolved these issues by allowing named function expressions. For example:</p>
+
+<pre class="brush: js">[1,2,3,4,5].map(function factorial (n) {
+ return !(n &gt; 1) ? 1 : factorial(n-1)*n;
+});</pre>
+
+<p>This has numerous benefits:</p>
+
+<ul>
+ <li>the function can be called like any other from inside your code</li>
+ <li>it does not create a variable in the outer scope (<a href="http://kangax.github.io/nfe/#example_1_function_expression_identifier_leaks_into_an_enclosing_scope">except for IE 8 and below</a>)</li>
+ <li>it has better performance than accessing the arguments object</li>
+</ul>
+
+<p>Another feature that was deprecated was <code>arguments.callee.caller</code>, or more specifically <code>Function.caller</code>. Why is this? Well, at any point in time you can find the deepest caller of any function on the stack, and as I said above looking at the call stack has one single major effect: it makes a large number of optimizations impossible, or much much more difficult. For example, if you cannot guarantee that a function <code>f</code> will not call an unknown function, it is not possible to inline <code>f</code>. Basically it means that any call site that may have been trivially inlinable accumulates a large number of guards:</p>
+
+<pre class="brush: js">function f (a, b, c, d, e) { return a ? b * c : d * e; }</pre>
+
+<p>If the JavaScript interpreter cannot guarantee that all the provided arguments are numbers at the point that the call is made, it needs to either insert checks for all the arguments before the inlined code, or it cannot inline the function. Now in this particular case a smart interpreter should be able to rearrange the checks to be more optimal and not check any values that would not be used. However in many cases that's just not possible and therefore it becomes impossible to inline.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_arguments.callee_in_an_anonymous_recursive_function">Using <code>arguments.callee</code> in an anonymous recursive function</h3>
+
+<p>A recursive function must be able to refer to itself. Typically, a function refers to itself by its name. However, an anonymous function (which can be created by a <a href="/en-US/docs/Web/JavaScript/Reference/Operators/function" title="JavaScript/Reference/Operators/Special/function">function expression</a> or the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function" title="JavaScript/Reference/Global_Objects/Function"><code>Function</code> constructor</a>) does not have a name. Therefore if there is no accessible variable referring to it, the only way the function can refer to itself is by <code>arguments.callee</code>.</p>
+
+<p>The following example defines a function, which, in turn, defines and returns a factorial function. This example isn't very practical, and there are nearly no cases where the same result cannot be achieved with <a href="/en-US/docs/Web/JavaScript/Reference/Operators/function" title="JavaScript/Reference/Operators/Special/function">named function expressions</a>.</p>
+
+<pre class="brush: js">function create() {
+ return function(n) {
+ if (n &lt;= 1)
+ return 1;
+ return n * arguments.callee(n - 1);
+ };
+}
+
+var result = create()(5); // returns 120 (5 * 4 * 3 * 2 * 1)</pre>
+
+<h3 id="A_use_of_arguments.callee_with_no_good_alternative">A use of <code>arguments.callee</code> with no good alternative</h3>
+
+<p>However, in a case like the following, there are not alternatives to <code>arguments.callee</code>, so its deprecation could be a bug (see {{Bug("725398")}}):</p>
+
+<pre class="brush: js">function createPerson (sIdentity) {
+ var oPerson = new Function("alert(arguments.callee.identity);");
+ oPerson.identity = sIdentity;
+ return oPerson;
+}
+
+var john = createPerson("John Smith");
+
+john();</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-10.6', 'Arguments Object')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Function")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/arguments/index.html b/files/zh-tw/web/javascript/reference/functions/arguments/index.html
new file mode 100644
index 0000000000..6b1d6a45a1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/arguments/index.html
@@ -0,0 +1,235 @@
+---
+title: Arguments 物件
+slug: Web/JavaScript/Reference/Functions/arguments
+tags:
+ - Functions
+ - JavaScript
+ - Reference
+ - arguments
+translation_of: Web/JavaScript/Reference/Functions/arguments
+---
+<div>
+<div>{{jsSidebar("Functions")}}</div>
+</div>
+
+<p><strong><code>arguments</code></strong> 物件是一個對應傳入函式之引數的類陣列(<code>Array-like</code>)物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">arguments</pre>
+
+<h2 id="描述">描述</h2>
+
+<div class="blockIndicator note">
+<p>Note: 如果你有在使用 ES6 語法,建議參考<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘參數</a>。</p>
+</div>
+
+<div class="blockIndicator note">
+<p>Note: 「類陣列 (Array-like)」 的意思是 <code>arguments</code> 一樣擁有 <code>length</code>這項屬性,以及從 0 開始的索引,但是它沒有陣列內建的方法像是 <code>forEach()</code> ,或是 <code>map()</code> 。</p>
+</div>
+
+<p>The <code>arguments</code> object is a local variable available within all (non-arrow) functions. You can refer to a function's arguments within the function by using the <code>arguments</code> object. This object contains an entry for each argument passed to the function, the first entry's index starting at 0.</p>
+
+<p>For example, if a function is passed three arguments, you can refer to them as follows:</p>
+
+<pre class="brush: js notranslate">arguments[0]
+arguments[1]
+arguments[2]
+</pre>
+
+<p>arguments 也可以被指定:</p>
+
+<pre class="brush: js notranslate">arguments[1] = 'new value';</pre>
+
+<p><code>arguments</code> 物件不是陣列。它與陣列非常相似,但是它沒有除了 <code>length</code> 這個屬性以外的其他陣列屬性。舉例,它沒有 <code>pop</code> 這個陣列方法。</p>
+
+<p>然而,它依然可以被轉換為真正的陣列(Array)。</p>
+
+<pre class="brush: js notranslate">var args = Array.prototype.slice.call(arguments);
+var args = [].slice.call(arguments);
+
+// ES2015
+const args = Array.from(arguments);
+</pre>
+
+<div class="warning">
+<p class="brush: js">Using slice on arguments prevents optimizations in some JavaScript engines (V8 for example - <a href="https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments">more information</a>). If you care for them, try constructing a new array by iterating through the arguments object instead. An alternative would be to use the despised <code>Array</code> constructor as a function:</p>
+
+<pre class="brush: js notranslate">var args = (arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments));</pre>
+</div>
+
+<p>You can use the <code>arguments</code> object if you call a function with more arguments than it is formally declared to accept. This technique is useful for functions that can be passed a variable number of arguments. Use <code><a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments/length">arguments.length</a></code> to determine the number of arguments passed to the function, and then process each argument by using the <code>arguments</code> object. To determine the number of parameters in the function <a href="/en-US/docs/Glossary/Signature/Function">signature</a>, use the <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/length">Function.length</a></code> property.</p>
+
+<h3 id="Using_typeof_with_Arguments">Using <code>typeof</code> with Arguments</h3>
+
+<p>The typeof arguments returns 'object'. </p>
+
+<pre class="notranslate">console.log(typeof arguments); // 'object' </pre>
+
+<p>The typeof individual arguments can be determined with the use of indexing.</p>
+
+<pre class="notranslate">console.log(typeof arguments[0]); //this will return the typeof individual arguments.</pre>
+
+<h3 id="Using_the_Spread_Syntax_with_Arguments">Using the Spread Syntax with Arguments</h3>
+
+<p>You can also use the {{jsxref("Array.from()")}} method or the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator">spread operator</a> to convert arguments to a real Array:</p>
+
+<pre class="brush: js notranslate">var args = Array.from(arguments);
+var args = [...arguments];
+</pre>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee">arguments.callee</a></code></dt>
+ <dd>Reference to the currently executing function.</dd>
+ <dt><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/caller">arguments.caller</a></code> {{ Obsolete_inline() }}</dt>
+ <dd>Reference to the function that invoked the currently executing function.</dd>
+ <dt><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/length">arguments.length</a></code></dt>
+ <dd>Reference to the number of arguments passed to the function.</dd>
+ <dt><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments/@@iterator">arguments[@@iterator]</a></code></dt>
+ <dd>Returns a new Array Iterator object that contains the values for each index in the arguments.</dd>
+</dl>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Defining_a_function_that_concatenates_several_strings">Defining a function that concatenates several strings</h3>
+
+<p>This example defines a function that concatenates several strings. The only formal argument for the function is a string that specifies the characters that separate the items to concatenate. The function is defined as follows:</p>
+
+<pre class="brush:js notranslate">function myConcat(separator) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return args.join(separator);
+}</pre>
+
+<p>You can pass any number of arguments to this function, and it creates a list using each argument as an item in the list.</p>
+
+<pre class="brush:js notranslate">// returns "red, orange, blue"
+myConcat(', ', 'red', 'orange', 'blue');
+
+// returns "elephant; giraffe; lion; cheetah"
+myConcat('; ', 'elephant', 'giraffe', 'lion', 'cheetah');
+
+// returns "sage. basil. oregano. pepper. parsley"
+myConcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley');</pre>
+
+<h3 id="Defining_a_function_that_creates_HTML_lists">Defining a function that creates HTML lists</h3>
+
+<p>This example defines a function that creates a string containing HTML for a list. The only formal argument for the function is a string that is "<code>u</code>" if the list is to be unordered (bulleted), or "<code>o</code>" if the list is to be ordered (numbered). The function is defined as follows:</p>
+
+<pre class="brush:js notranslate">function list(type) {
+ var result = '&lt;' + type + 'l&gt;&lt;li&gt;';
+ var args = Array.prototype.slice.call(arguments, 1);
+ result += args.join('&lt;/li&gt;&lt;li&gt;');
+ result += '&lt;/li&gt;&lt;/' + type + 'l&gt;'; // end list
+
+ return result;
+}</pre>
+
+<p>You can pass any number of arguments to this function, and it adds each argument as an item to a list of the type indicated. For example:</p>
+
+<pre class="brush:js notranslate">var listHTML = list('u', 'One', 'Two', 'Three');
+
+/* listHTML is:
+
+"&lt;ul&gt;&lt;li&gt;One&lt;/li&gt;&lt;li&gt;Two&lt;/li&gt;&lt;li&gt;Three&lt;/li&gt;&lt;/ul&gt;"
+
+*/</pre>
+
+<h3 id="Rest_default_and_destructured_parameters">Rest, default, and destructured parameters</h3>
+
+<p>The <code>arguments</code> object can be used in conjunction with <a href="/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest</a>, <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default</a>, and <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructured</a> parameters.</p>
+
+<pre class="brush: js notranslate">function foo(...args) {
+ return args;
+}
+foo(1, 2, 3); // [1,2,3]
+</pre>
+
+<p>While the presence of <a href="/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest</a>, <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default</a>, or <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructured</a> parameters does not alter the <a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode#Making_eval_and_arguments_simpler">behavior of the <code>arguments</code> object in strict mode code</a>, there is a subtle difference for non-strict code.</p>
+
+<p>When a non-strict function <strong><strong>does </strong>not</strong> contain <a href="/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest</a>, <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default</a>, or <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructured</a> parameters, then the values in the <code>arguments</code> object <strong>do</strong> track the values of the arguments (and vice versa). See the code below:</p>
+
+<pre class="brush: js notranslate">function func(a) {
+ arguments[0] = 99; // updating arguments[0] also updates a
+ console.log(a);
+}
+func(10); // 99
+</pre>
+
+<p>and</p>
+
+<pre class="brush: js notranslate">function func(a) {
+ a = 99; // updating a also updates arguments[0]
+ console.log(arguments[0]);
+}
+func(10); // 99
+</pre>
+
+<p>When a non-strict function <strong>does</strong> contain <a href="/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest</a>, <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default</a>, or <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructured</a> parameters, then the values in the <code>arguments</code> object <strong>do not</strong> track the values of the arguments (and vice versa). Instead, they reflect the arguments provided at the time of invocation:</p>
+
+<pre class="brush: js notranslate">function func(a = 55) {
+ arguments[0] = 99; // updating arguments[0] does not also update a
+ console.log(a);
+}
+func(10); // 10</pre>
+
+<p>and</p>
+
+<pre class="brush: js notranslate">function func(a = 55) {
+ a = 99; // updating a does not also update arguments[0]
+ console.log(arguments[0]);
+}
+func(10); // 10
+</pre>
+
+<p>and</p>
+
+<pre class="brush: js notranslate">function func(a = 55) {
+ console.log(arguments[0]);
+}
+func(); // undefined</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-10.6', 'Arguments Object')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-arguments-exotic-objects', 'Arguments Exotic Objects')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.functions.arguments")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Function")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/arrow_functions/index.html b/files/zh-tw/web/javascript/reference/functions/arrow_functions/index.html
new file mode 100644
index 0000000000..8eac06ba55
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/arrow_functions/index.html
@@ -0,0 +1,340 @@
+---
+title: 箭頭函式
+slug: Web/JavaScript/Reference/Functions/Arrow_functions
+translation_of: Web/JavaScript/Reference/Functions/Arrow_functions
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p><strong>箭頭函式運算式</strong>(arrow function expression)擁有比<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/function">函式運算式</a>還簡短的語法。它沒有自己的 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/this">this</a></code>、<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/arguments">arguments</a>、<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/super">super</a>、<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/new.target">new.target</a> 等語法。本函式運算式適用於非方法的函式,但不能被用作建構式(constructor)。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/functions-arrow.html")}}</div>
+
+<h2 id="基本語法">基本語法</h2>
+
+<pre class="syntaxbox notranslate">(參數1, 參數2, …, 參數N) =&gt; { 陳述式; }
+
+(參數1, 參數2, …, 參數N) =&gt; 表示式;
+// 等相同(參數1, 參數2, …, 參數N) =&gt; { return 表示式; }
+
+// 只有一個參數時,括號才能不加:
+(單一參數) =&gt; { 陳述式; }
+單一參數 =&gt; { 陳述式; }
+
+//若無參數,就一定要加括號:
+() =&gt; { statements }
+</pre>
+
+<h2 id="進階語法">進階語法</h2>
+
+<pre class="syntaxbox notranslate">// 用大括號將內容括起來,返回一個物件字面值表示法:
+params =&gt; ({foo: bar})
+
+// 支援<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘參數</a>與<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Default_parameters">預設參數</a>
+(param1, param2, ...rest) =&gt; { statements }
+(param1 = defaultValue1, param2, …, paramN = defaultValueN) =&gt; {
+statements }
+
+// 也支援 parameter list 的<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解構</a>
+var f = ([a, b] = [1, 2], {x: c} = {x: a + b}) =&gt; a + b + c; f(); // 6
+</pre>
+
+<h2 id="說明">說明</h2>
+
+<p>也可參閱 <a href="https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/">"ES6 In Depth: Arrow functions" on hacks.mozilla.org</a>。</p>
+
+<p>箭頭函式有兩個重要的特性:更短的函式寫法與 <code>this</code> 變數的非綁定。</p>
+
+<h3 id="更短的函式寫法">更短的函式寫法</h3>
+
+<pre class="brush: js notranslate">var elements = [
+ 'Hydrogen',
+ 'Helium',
+ 'Lithium',
+ 'Beryllium'
+];
+
+// 這段函式會輸出[8, 6, 7, 9]這個陣列
+elements.<a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/map">map</a>(function(element) {
+ return element.length;
+});
+
+// 上方這種一般的函式,可以被改寫成下方的箭頭函式
+elements.map((element) =&gt; {
+  return element.length;
+}); // [8, 6, 7, 9]
+
+// 如果輸入的參數只有一個,我們可以移除掉外面的括號
+elements.map(element =&gt; {
+  return element.length;
+}); // [8, 6, 7, 9]
+
+// 當箭頭函式裡的內容只有'return'的時候,我們可以拿掉return和外面的大括號
+elements.map(element =&gt; element.length); // [8, 6, 7, 9]
+
+// 在這個範例中,因為我們只需要length這個屬性,所以也可以使用<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解構賦值</a>:
+// 下方的'length'對應到我們想取得的屬性,而'lengthFooBArX'只是很普通的變數名稱,
+// 可以被任意修改成你想要的名字
+elements.map(({ length: lengthFooBArX }) =&gt; lengthFooBArX); // [8, 6, 7, 9]
+
+// 上面這種解構賦值之後的參數也可以被改寫為下面這樣。但要注意的是,在這個範例中,
+// 我們不是要指定'length'這個值給一個虛構的屬性,而是這個變數的名稱'length'本身就是
+// 用來當成我們想從物件上取得的屬性
+elements.map(({ length }) =&gt; length); // [8, 6, 7, 9]
+</pre>
+
+<h3 id="this_不分家"><code>this</code> 不分家</h3>
+
+<p>在有箭頭函數之前,每個新函式是依據如何被呼叫來定義自己的 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/this">this</a></code> 變數<br>
+ 例如:</p>
+
+<ul>
+ <li>在建構子時是一個新物件</li>
+ <li>在呼叫<a href="/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">嚴格模式</a>函數時是 undefined</li>
+ <li>以物件方法呼叫時則為基礎物件</li>
+ <li>等等....</li>
+</ul>
+
+<p>事實證明這對物件導向程式設計來說並不理想。</p>
+
+<pre class="brush: js notranslate">function Person() {
+ // Person() 建構式將 this 定義為它自己的一個實體
+ this.age = 0;
+
+ setInterval(function growUp() {
+ // 在非嚴格模式下, growUp() 函式把 this 定義為全域物件
+  // (因為那是 growUp()執行的所在),
+ // 與 Person() 建構式所定義的 this 有所不同
+ this.age++;
+ }, 1000);
+}
+
+var p = new Person();</pre>
+
+<p>在 ECMAScript 3/5 裡面,有關 <code>this</code> 的問題,可以透過指派 <code>this</code> 值給可以關閉的變數解決。</p>
+
+<pre class="brush: js notranslate">function Person() {
+ var self = this; // 有些人喜歡 `that` 而不是 `self`.
+ // 選好一種取法後始終如一
+ self.age = 0;
+
+ setInterval(function growUp() {
+ // 這個 callback 參考 `self` 變數,為預期中的物件。
+ self.age++;
+ }, 1000);
+}</pre>
+
+<p>或者透過 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">bind</a> 函式來綁定 <code>this</code> 變數到指定函式(以上面為例,就是 <code>growUp()</code> 函式)。</p>
+
+<p>箭頭函式並不擁有自己的 <code>this 變</code>數<code>;</code>使用的 this <code>值來自</code>封閉的文本上下文,也就是說,箭頭函式遵循常規變量查找規則。因此,如果在當前範圍中搜索不到 this 變量時,他們最終會尋找其封閉範圍。</p>
+
+<p>因此,在以下程式碼內,傳遞給 <code>setInterval</code> 的 箭頭函式中的<code>this</code> ,會與封閉函式的 <code>this</code> 值相同:</p>
+
+<pre class="brush: js notranslate">function Person(){
+ this.age = 0;
+
+ setInterval(() =&gt; {
+ this.age++; // |this| 適切的參考了Person建構式所建立的物件
+ }, 1000);
+}
+
+var p = new Person();</pre>
+
+<h4 id="和嚴格模式的關係">和嚴格模式的關係</h4>
+
+<p>由於 <code>this</code> 變數具有詞彙上綁定意義,所以<a href="/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">嚴格模式</a>的宣告對 <code>this</code> 的作用將被忽略。</p>
+
+<pre class="brush: js notranslate">var f = () =&gt; {'use strict'; return this};
+f() === window; // 或是 global 物件</pre>
+
+<p>但嚴格模式的其他作用依舊存在。</p>
+
+<h4 id="由_call_與_apply_函式呼叫">由 call 與 apply 函式呼叫</h4>
+
+<p>由於箭頭函式並沒有自己的 <code>this</code>,所以透過 <code>call()</code> 或 <code>apply()</code> 呼叫箭頭函式只能傳入參數。<code>thisArg</code> 將會被忽略。</p>
+
+<pre class="brush: js notranslate">var adder = {
+ base : 1,
+ add : function(a) {
+ var f = v =&gt; v + this.base;
+ return f(a);
+ },
+ addThruCall: function(a) {
+ var f = v =&gt; v + this.base;
+ var b = {
+ base : 2
+ };
+ return f.call(b, a);
+ }
+};
+console.log(adder.add(1)); // 顯示 2
+console.log(adder.addThruCall(1)); // 依舊顯示 2
+</pre>
+
+<h3 id="不綁定_arguments">不綁定 <code>arguments</code></h3>
+
+<p>箭頭函式並沒有自己的 <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/arguments"><code>arguments</code> 物件</a>。所以在此例中,<code>arguments</code> 只是參考到 enclosing 作用域裡面的相同變數:</p>
+
+<pre class="brush: js notranslate">var arguments = [1, 2, 3];
+var arr = () =&gt; arguments[0];
+
+arr(); // 1
+
+function foo(n) {
+ var f = () =&gt; arguments[0] + n; // <em>foo</em>'s implicit arguments binding. arguments[0] is n
+ return f();
+}
+
+foo(1); // 2</pre>
+
+<p>大多時候,使用<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘參數</a> 是取代 <code>arguments</code> 物件的較好方式。</p>
+
+<pre class="brush: js notranslate">function foo(n) {
+ var f = (...args) =&gt; args[0] + n;
+ return f(10);
+}
+
+foo(1); // 11</pre>
+
+<h3 id="將箭頭函式撰寫為方法">將箭頭函式撰寫為方法</h3>
+
+<p>如同前述,箭頭函式運算式最適合用在非方法的函式。來看看如果要把它們當成方法來用,會發生什麼事:</p>
+
+<pre class="brush: js notranslate"><code>'use strict';
+var obj = {
+ i: 10,
+ b: () =&gt; console.log(this.i, this),
+ c: function() {
+ console.log(this.i, this);
+ }
+}
+obj.b(); // 印出 undefined, Object {...}
+obj.c(); // 印出 10, Object {...}</code></pre>
+
+<p>箭頭函式並沒有自己的 <code>this</code>。另一個例子與 {{jsxref("Object.defineProperty()")}} 有關:</p>
+
+<pre class="brush: js notranslate">'use strict';
+
+var obj = {
+ a: 10
+};
+
+Object.defineProperty(obj, 'b', {
+ get: () =&gt; {
+ console.log(this.a, typeof this.a, this); // undefined 'undefined' Window {...} (or the global object)
+ return this.a + 10; // represents global object 'Window', therefore 'this.a' returns 'undefined'
+ }
+});
+</pre>
+
+<h3 id="使用_new_運算子">使用 <code>new</code> 運算子</h3>
+
+<p>箭頭函式不可作為建構式使用;若使用於建構式,會在使用 <code>new</code> 時候拋出錯誤。</p>
+
+<pre class="brush: js notranslate">var Foo = () =&gt; {};
+var foo = new Foo(); // TypeError: Foo is not a constructor</pre>
+
+<h3 id="使用_prototype_屬性">使用 <code>prototype</code> 屬性</h3>
+
+<p>箭頭函式並沒有原型(<code>prototype</code>)屬性。</p>
+
+<pre class="brush: js notranslate">var Foo = () =&gt; {};
+console.log(Foo.prototype); // undefined
+</pre>
+
+<h3 id="使用關鍵字_yield">使用關鍵字 <code>yield</code></h3>
+
+<p><code><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/yield">yield</a></code> 關鍵字無法用於箭頭函式的 body(except when permitted within functions further nested within it)。因此,箭頭函式無法使用 generator。</p>
+
+<h2 id="函式主體(Function_body)">函式主體(Function body)</h2>
+
+<p>箭頭函式可以變成 concise body 或者平常使用的 block body。</p>
+
+<p>在 concise body 裡面只需要輸入運算式,就會附上內建的回傳。在 block body 裡面就必須附上明確的 <code>return</code> 宣告。</p>
+
+<pre class="brush: js notranslate"><code>var func = x =&gt; x * x; // concise 語法會內建 "return"
+var func = (x, y) =&gt; { return x + y; }; // block body 需要明確的 "return"</code></pre>
+
+<h2 id="回傳物件字面值">回傳物件字面值</h2>
+
+<p>請注意只使用 <code>params =&gt; {object:literal}</code> 並不會按照期望般回傳物件字面值(object literal)。</p>
+
+<pre class="brush: js notranslate"><code>var func = () =&gt; { foo: 1 }; // Calling func() returns undefined!
+var func = () =&gt; { foo: function() {} }; // SyntaxError: Unexpected token (</code></pre>
+
+<p>因為在大括弧(<code>{}</code>)裡面的文字會被解析為有序宣告(例如 <code>foo</code> 會被當作標記(label)、而不是物件的 key )</p>
+
+<p>要記得把物件字面值包在圓括弧內。</p>
+
+<pre class="brush: js notranslate"><code>var func = () =&gt; ({foo: 1});
+var func = () =&gt; ({ foo: function() {} }); </code>
+</pre>
+
+<h2 id="換行">換行</h2>
+
+<p>箭頭函式不可以在參數及箭頭間包含換行。</p>
+
+<pre class="brush: js notranslate"><code>var func = ()
+ =&gt; 1; // SyntaxError: expected expression, got '=&gt;'</code></pre>
+
+<h2 id="Parsing_order">Parsing order</h2>
+
+<p>箭頭函式的箭頭儘管不是操作符,但藉著<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">運算子優先等級</a>,箭頭函式有著和普通函式不相同的特殊解析規則。</p>
+
+<pre class="brush: js notranslate"><code>let callback;
+
+callback = callback || function() {}; // ok
+callback = callback || () =&gt; {}; // SyntaxError: invalid arrow-function arguments
+callback = callback || (() =&gt; {}); // ok</code></pre>
+
+<h2 id="更多範例">更多範例</h2>
+
+<pre class="brush: js notranslate">// 回傳 undefined 的箭頭函式
+let empty = () =&gt; {};
+
+(() =&gt; "foobar")() // 回傳 "foobar"
+
+var simple = a =&gt; a &gt; 15 ? 15 : a;
+simple(16); // 15
+simple(10); // 10
+
+let max = (a, b) =&gt; a &gt; b ? a : b;
+
+// Easy array filtering, mapping, ...
+
+var arr = [5, 6, 13, 0, 1, 18, 23];
+var sum = arr.reduce((a, b) =&gt; a + b); // 66
+var even = arr.filter(v =&gt; v % 2 == 0); // [6, 0, 18]
+var double = arr.map(v =&gt; v * 2); // [10, 12, 26, 0, 2, 36, 46]
+
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-arrow-function-definitions', 'Arrow Function Definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.functions.arrow_functions")}}</p>
+</div>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li><a href="https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/">"ES6 In Depth: Arrow functions" on hacks.mozilla.org</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html b/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html
new file mode 100644
index 0000000000..6faacba9a3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/default_parameters/index.html
@@ -0,0 +1,292 @@
+---
+title: 預設參數( Default parameters )
+slug: Web/JavaScript/Reference/Functions/Default_parameters
+translation_of: Web/JavaScript/Reference/Functions/Default_parameters
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p><strong>函式預設參數 </strong>允許沒有值傳入或是傳入值為 <code>undefined 的情況下,參數能以指定的預設值初始化。</code></p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">function [<em>name</em>]([<em>param1</em>[ = defaultValue1 ][, ..., <em>paramN</em>[ = defaultValueN ]]]) {
+ <em>要執行的程序</em>
+}
+</pre>
+
+<h2 id="說明">說明</h2>
+
+<p>在 JavaScript 中,函式的參數預設值都為 <code>{{jsxref("undefined")}} 。然而,指定不同的預設值可能在一些場景很有用。這也是函式參數預設值可以幫上忙的地方。</code></p>
+
+<p>以往設定預設值有個普遍方法:在函式的內容裡檢查傳入參數是否為 <code>undefined ,如果是的話,爲他指定一個值。如下列範例,若函式被呼叫時,並沒有提供 b 的值,它的值就會是 undefined,在計算 a*b 時,以及呼叫 multiply 時,就會回傳 NaN。然而這在範例的第二行被阻止了:</code>:</p>
+
+<pre class="brush: js notranslate">function multiply(a, b) {
+ b = (typeof b !== 'undefined') ? b : 1;
+ return a * b;
+}
+
+multiply(5, 2); // 10
+multiply(5, 1); // 5
+multiply(5); // 5
+</pre>
+
+<p>有了 ES2015 的預設參數,再也不用於函式進行檢查了,現在只要簡單的在函式的起始處為 b 指定 1 的值:</p>
+
+<pre class="brush: js notranslate">function multiply(a, b = 1) {
+ return a * b;
+}
+
+multiply(5, 2); // 10
+multiply(5, 1); // 5
+multiply(5); // 5
+</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="傳入_undefined">傳入 <code>undefined</code></h3>
+
+<p>這邊第二段函式呼叫中,僅管第二個傳入參數在呼叫時明確地指定為undefined(雖不是null),其顏色參數的值是預設值(rosybrown)。</p>
+
+<pre class="brush: js notranslate">function setBackgroundColor(element, color = 'rosybrown') {
+ element.style.backgroundColor = color;
+}
+
+setBackgroundColor(someDiv); // color set to 'rosybrown'
+setBackgroundColor(someDiv, undefined); // color set to 'rosybrown' too
+setBackgroundColor(someDiv, 'blue'); // color set to 'blue'
+</pre>
+
+<h3 id="呼叫時賦予值">呼叫時賦予值</h3>
+
+<p>跟Python等語言不同的地方是,先前預設的代數值會拿來進行函式內的程序,也因此在函式呼叫的時候,會建立新物件。</p>
+
+<pre class="brush: js notranslate">function append(value, array = []) {
+ array.push(value);
+ return array;
+}
+
+append(1); //[1]
+append(2); //[2], 而非 [1, 2]
+</pre>
+
+<p>諸如此類的做法,也適用在函式和變量。</p>
+
+<pre class="brush: js notranslate">function callSomething(thing = something()) {
+ return thing;
+}
+
+function something() {
+ return 'sth';
+}
+
+callSomething(); //sth</pre>
+
+<h3 id="預設的參數中,先設定的可提供之後設定的使用">預設的參數中,先設定的可提供之後設定的使用</h3>
+
+<p>先前有碰到的參數,後來的即可使用。</p>
+
+<pre class="brush: js notranslate">function singularAutoPlural(singular, plural = singular + '們',
+ rallyingCry = plural + ',進攻啊!!!') {
+ return [singular, plural, rallyingCry];
+}
+
+//["壁虎","壁虎們", "壁虎,進攻啊!!!"]
+singularAutoPlural('壁虎');
+
+//["狐狸","火紅的狐狸們", "火紅的狐狸們,進攻啊!!!"]
+singularAutoPlural('狐狸', '火紅的狐狸們');
+
+//["鹿兒", "鹿兒們", "鹿兒們 ... 有所好轉"]
+singularAutoPlural('鹿兒', '鹿兒們', '鹿兒們平心靜氣的 \
+ 向政府請願,希望事情有所好轉。');
+</pre>
+
+<p>This functionality is approximated in a straight forward fashion and demonstrates how many edge cases are handled.</p>
+
+<pre class="brush: js notranslate">function go() {
+ return ':P';
+}
+
+function withDefaults(a, b = 5, c = b, d = go(), e = this,
+ f = arguments, g = this.value) {
+ return [a, b, c, d, e, f, g];
+}
+
+function withoutDefaults(a, b, c, d, e, f, g) {
+ switch (arguments.length) {
+ case 0:
+ a;
+ case 1:
+ b = 5;
+ case 2:
+ c = b;
+ case 3:
+ d = go();
+ case 4:
+ e = this;
+ case 5:
+ f = arguments;
+ case 6:
+ g = this.value;
+ default:
+ }
+ return [a, b, c, d, e, f, g];
+}
+
+withDefaults.call({value: '=^_^='});
+// [undefined, 5, 5, ":P", {value:"=^_^="}, arguments, "=^_^="]
+
+
+withoutDefaults.call({value: '=^_^='});
+// [undefined, 5, 5, ":P", {value:"=^_^="}, arguments, "=^_^="]
+</pre>
+
+<h3 id="函式內再定義函式">函式內再定義函式</h3>
+
+<p>Introduced in Gecko 33 {{geckoRelease(33)}}. Functions declared in the function body cannot be referred inside default parameters and throw a {{jsxref("ReferenceError")}} (currently a {{jsxref("TypeError")}} in SpiderMonkey, see {{bug(1022967)}}). Default parameters are always executed first, function declarations inside the function body evaluate afterwards.</p>
+
+<pre class="brush: js notranslate">// 行不通的! 最後會丟出 ReferenceError。
+function f(a = go()) {
+ function go() { return ':P'; }
+}
+</pre>
+
+<h3 id="Parameters_without_defaults_after_default_parameters">Parameters without defaults after default parameters</h3>
+
+<p>Prior to Gecko 26 {{geckoRelease(26)}}, the following code resulted in a {{jsxref("SyntaxError")}}. This has been fixed in {{bug(777060)}} and works as expected in later versions. Parameters are still set left-to-right, overwriting default parameters even if there are later parameters without defaults.</p>
+
+<pre class="brush: js notranslate">function f(x = 1, y) {
+ return [x, y];
+}
+
+f(); // [1, undefined]
+f(2); // [2, undefined]
+</pre>
+
+<h3 id="Destructured_parameter_with_default_value_assignment">Destructured parameter with default value assignment</h3>
+
+<p>You can use default value assignment with the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructuring assignment</a> notation:</p>
+
+<pre class="brush: js notranslate">function f([x, y] = [1, 2], {z: z} = {z: 3}) {
+ return x + y + z;
+}
+
+f(); // 6</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-function-definitions', 'Function Definitions')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-definitions', 'Function Definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器的兼容性">瀏覽器的兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能特徵</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatChrome(49)}}</td>
+ <td>{{CompatGeckoDesktop("15.0")}}</td>
+ <td>Edge</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ <tr>
+ <td>Parameters without defaults after default parameters</td>
+ <td>{{CompatChrome(49)}}</td>
+ <td>{{CompatGeckoDesktop("26.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ <tr>
+ <td>Destructured parameter with default value assignment</td>
+ <td>{{CompatChrome(49)}}</td>
+ <td>{{CompatGeckoDesktop("41.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>功能特徵</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(49)}}</td>
+ <td>{{CompatGeckoMobile("15.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(49)}}</td>
+ </tr>
+ <tr>
+ <td>Parameters without defaults after default parameters</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(49)}}</td>
+ <td>{{CompatGeckoMobile("26.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatChrome(49)}}</td>
+ </tr>
+ <tr>
+ <td>Destructured parameter with default value assignment</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("41.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="要不要也看看">要不要也看看</h2>
+
+<ul>
+ <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values" rel="external" title="http://wiki.ecmascript.org/doku.php?id=harmony:parameter_default_values">Original proposal at ecmascript.org</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/get/index.html b/files/zh-tw/web/javascript/reference/functions/get/index.html
new file mode 100644
index 0000000000..c01f8164ca
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/get/index.html
@@ -0,0 +1,170 @@
+---
+title: getter
+slug: Web/JavaScript/Reference/Functions/get
+translation_of: Web/JavaScript/Reference/Functions/get
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p><strong><code>get</code></strong> 語法會將物件屬性,綁定到屬性被檢索時,所呼叫的函式。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/functions-getter.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">{get <em>prop</em>() { ... } }
+{get <em>[expression]</em>() { ... } }</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>prop</code></dt>
+ <dd>要綁定到給定函式的名稱。</dd>
+ <dt>expression</dt>
+ <dd>自 ECMAScript 2015 開始,可以用計算屬性名稱(computed property name),綁定到給定函式。</dd>
+</dl>
+
+<h2 id="敘述">敘述</h2>
+
+<p>有時候,物件的屬性可能需要回傳動態數值、或要在不使用明確的方法呼叫下,反映出內部變數的狀態。在 JavaScript 可以用 <em>getter</em> 達到這個目的。儘管可以用 getter 與 setter 的關聯建立虛擬屬性的類型,但 getter 無法被綁定到同時擁有實際數值的屬性。</p>
+
+<p>使用 <code>get</code> 語法時,請注意以下情況:</p>
+
+<div>
+<ul>
+ <li>可以擁有一個以數字或字串為代表的標示符;</li>
+ <li>最少要有零個參數(請參見 <a class="external" href="http://whereswalden.com/2010/08/22/incompatible-es5-change-literal-getter-and-setter-functions-must-now-have-exactly-zero-or-one-arguments/" rel="external nofollow">Incompatible <abbr title="ECMAScript 5th edition">ES5</abbr> change: literal getter and setter functions must now have exactly zero or one arguments</a> 的詳細資料)</li>
+ <li>不能以有另一個 <code>get</code> 的 object literal、或相同屬性入口(data entry)的 data 形式出現(不能使用 <code>{ get x() { }, get x() { } }</code> and <code>{ x: ..., get x() { } }</code>)。</li>
+</ul>
+</div>
+
+<p>getter 可以用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code> 操作符移除。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="在物件初始器(object_initializers)內定義新物件的_getter">在物件初始器(object initializers)內定義新物件的 getter</h3>
+
+<p>這程式碼將給 <code>obj</code> 物件建立虛擬屬性 <code>latest</code>,它會回傳 <code>log</code> 陣列的最後一個單元。</p>
+
+<pre class="brush: js">var obj = {
+  log: ['example','test'],
+  get latest() {
+    if (this.log.length == 0) return undefined;
+    return this.log[this.log.length - 1];
+  }
+}
+console.log(obj.latest); // "test".
+</pre>
+
+<p>請注意 <code>latest</code> 不會因為數值被指派而改變。</p>
+
+<h3 id="使用_delete_操作符移除_getter">使用 <code>delete</code> 操作符移除 getter</h3>
+
+<p>如果想移除 getter,可以使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code> 完成之:</p>
+
+<pre class="brush: js">delete obj.latest;
+</pre>
+
+<h3 id="使用_defineProperty_給現有物件定義_getter">使用 <code>defineProperty</code> 給現有物件定義 getter</h3>
+
+<p>若想在任何時候給現有物件添增 getter,請使用 {{jsxref("Object.defineProperty()")}}。</p>
+
+<pre class="brush: js">var o = {a: 0};
+
+Object.defineProperty(o, 'b', { get: function() { return this.a + 1; } });
+
+console.log(o.b) // Runs the getter, which yields a + 1 (which is 1)</pre>
+
+<h3 id="使用計算屬性名">使用計算屬性名</h3>
+
+<pre class="brush: js">var expr = 'foo';
+
+var obj = {
+ get [expr]() { return 'bar'; }
+};
+
+console.log(obj.foo); // "bar"</pre>
+
+<h3 id="Smart_self-overwriting_lazy_getters">Smart / self-overwriting / lazy getters</h3>
+
+<p>Getter 提供了定義物件屬性的方法,但它本身並不會去自動計算,直到想訪問它。除非需要用 getter,否則數值計算會被延緩;如果不需要用到 getter,那就永遠無須支付計算的開銷。</p>
+
+<p>針對屬性值 lazy 或 delay、並暫存以留作未來訪問的最佳化技巧稱作 <strong>smart 或 <a href="https://en.wikipedia.org/wiki/Memoization">memoized</a> getter</strong>:初次計算時會呼叫 getter、接著被暫存以便在不重算的情況下做後續訪問。這種技巧在以下情況會派上用場:</p>
+
+<ul>
+ <li>如果數值開銷很昂貴(例如需要大量 RAM 或 CPU 時間、產生 worker 執行緒、檢索遠端文件等)</li>
+ <li>如果現在並不需要數值:可能是現在用不到、或在某些情況下完全用不到。</li>
+ <li>如果使用的話,該數值會被訪問數次、且該數值永遠不會更改、或不應該更改。</li>
+</ul>
+
+<p>也就是說,出於 getter 不會重新計算的理由,不要針對數值預期會改變的屬性,使用 lazy getter。</p>
+
+<p>下例的物件擁有作為自己的屬性的 getter。在取得該屬性後,它會從物件被移除、並以隱式數值屬性重新增加、最後回傳之。</p>
+
+<pre class="brush: js">get notifier() {
+ delete this.notifier;
+ return this.notifier = document.getElementById('bookmarked-notification-anchor');
+},</pre>
+
+<p>針對 Firefox 程式碼,另請參見定義 <code><a href="/zh-TW/docs/Mozilla/JavaScript_code_modules/XPCOMUtils.jsm#defineLazyGetter()">defineLazyGetter()</a></code> 函式的 XPCOMUtils.jsm 程式模塊。</p>
+
+<h3 id="get_與_defineProperty"><code>get</code> 與 <code>defineProperty</code></h3>
+
+<p>在使用 {{jsxref("classes")}} 時,儘管 <code>get</code> 關鍵字與 {{jsxref("Object.defineProperty()")}} 會出現相同結果,但其中有微妙的差異。</p>
+
+<p>在使用 <code>get</code> 時,屬性會在物件的原型被定義;而在使用 {{jsxref("Object.defineProperty()")}} 時,屬性會在被套用的實例內定義。</p>
+
+<pre class="brush: js">class Example {
+ get hello() {
+ return 'world';
+ }
+}
+
+const obj = new Example();
+console.log(obj.hello);
+// "world"
+console.log(Object.getOwnPropertyDescriptor(obj, 'hello'));
+// undefined
+console.log(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(obj), 'hello'));
+// { configurable: true, enumerable: false, get: function get hello() { return 'world'; }, set: undefined }</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.1.5', 'Object Initializer')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初始定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>增加計算屬性名。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{Compat("javascript.functions.get")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/set">setter</a></li>
+ <li>{{jsxref("Operators/delete", "delete")}}</li>
+ <li>{{jsxref("Object.defineProperty()")}}</li>
+ <li>{{jsxref("Object.defineGetter", "__defineGetter__")}}</li>
+ <li>{{jsxref("Object.defineSetter", "__defineSetter__")}}</li>
+ <li>JavaScript 教學的<a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">定義 Getter 與 Setter</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/index.html b/files/zh-tw/web/javascript/reference/functions/index.html
new file mode 100644
index 0000000000..718cc30c3e
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/index.html
@@ -0,0 +1,617 @@
+---
+title: Functions
+slug: Web/JavaScript/Reference/Functions
+tags:
+ - Function
+ - Functions
+ - JavaScript
+ - NeedsTranslation
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Functions
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p>Generally speaking, a function is a "subprogram" that can be <em>called</em> by code external (or internal in the case of recursion) to the function. Like the program itself, a function is composed of a sequence of statements called the <em>function body</em>. Values can be <em>passed</em> to a function, and the function can <em>return</em> a value.</p>
+
+<p>In JavaScript, functions are first-class objects, i.e. they are objects and can be manipulated and passed around just like any other object. Specifically, they are <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function">Function</a></code> objects.</p>
+
+<p>For more examples and explanations, see also the <a href="/en-US/docs/Web/JavaScript/Guide/Functions">JavaScript guide about functions</a>.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>Every function in JavaScript is a <code>Function</code> object. See {{jsxref("Function")}} for information on properties and methods of <code>Function</code> objects.</p>
+
+<p>Functions are not the same as procedures. A function always returns a value, but a procedure may or may not return any value.</p>
+
+<p>To return a specific value other than the default, a function must have a <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/return">return</a></code> statement that specifies the value to return. A function without a return statement will return a default value. In the case of a <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor">constructor</a> called with the <code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/new">new</a></code> keyword, the default value is the value of its <code>this</code> parameter. For all other functions, the default return value is <code>undefined</code>.</p>
+
+<p>The parameters of a function call are the function's <em>arguments</em>. Arguments are passed to functions <em>by value</em>. If the function changes the value of an argument, this change is not reflected globally or in the calling function. However, object references are values, too, and they are special: if the function changes the referred object's properties, that change is visible outside the function, as shown in the following example:</p>
+
+<pre class="brush: js">/* Declare the function 'myFunc' */
+function myFunc(theObject) {
+ theObject.brand = "Toyota";
+ }
+
+ /*
+ * Declare variable 'mycar';
+ * create and initialize a new Object;
+ * assign reference to it to 'mycar'
+ */
+ var mycar = {
+ brand: "Honda",
+ model: "Accord",
+ year: 1998
+ };
+
+ /* Logs 'Honda' */
+ console.log(mycar.brand);
+
+ /* Pass object reference to the function */
+ myFunc(mycar);
+
+ /*
+ * Logs 'Toyota' as the value of the 'brand' property
+ * of the object, as changed to by the function.
+ */
+ console.log(mycar.brand);
+</pre>
+
+<p>The <a href="/en-US/docs/Web/JavaScript/Reference/Operators/this"><code>this</code> keyword</a> does not refer to the currently executing function, so you must refer to <code>Function</code> objects by name, even within the function body.</p>
+
+<h2 id="定義函式_Defining_functions">定義函式 Defining functions</h2>
+
+<p>以下幾個方法去定義函式 (function)</p>
+
+<h3 id="The_function_declaration_(function_statement)">The function declaration (<code>function</code> statement)</h3>
+
+<p>There is a special syntax for declaring functions (see <a href="/en-US/docs/Web/JavaScript/Reference/Statements/function">function statement</a> for details):</p>
+
+<pre class="syntaxbox">function <em>name</em>([<em>param</em>[, <em>param</em>[, ... <em>param</em>]]]) {
+ <em>statements</em>
+}
+</pre>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The function name.</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>The name of an argument to be passed to the function. A function can have up to 255 arguments.</dd>
+</dl>
+
+<dl>
+ <dt><code>statements</code></dt>
+ <dd>The statements comprising the body of the function.</dd>
+</dl>
+
+<h3 id="The_function_expression_(function_expression)">The function expression (<code>function</code> expression)</h3>
+
+<p>A function expression is similar to and has the same syntax as a function declaration (see <a href="/en-US/docs/Web/JavaScript/Reference/Operators/function">function expression</a> for details):</p>
+
+<pre class="syntaxbox">function [<em>name</em>]([<em>param</em>] [, <em>param</em>] [..., <em>param</em>]) {
+ <em>statements</em>
+}
+</pre>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The function name. Can be omitted, in which case the function becomes known as an anonymous function.</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>The name of an argument to be passed to the function. A function can have up to 255 arguments.</dd>
+ <dt><code>statements</code></dt>
+ <dd>The statements which comprise the body of the function.</dd>
+</dl>
+
+<h3 id="The_generator_function_declaration_(function*_statement)">The generator function declaration (<code>function*</code> statement)</h3>
+
+<div class="note">
+<p><strong>Note:</strong> Generator function are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<p>There is a special syntax for declaration generator functions (see {{jsxref('Statements/function*', 'function* statement')}} for details):</p>
+
+<pre class="syntaxbox">function* <em>name</em>([<em>param</em>[, <em>param</em>[, ... <em>param</em>]]]) {
+ <em>statements</em>
+}
+</pre>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The function name.</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>The name of an argument to be passed to the function. A function can have up to 255 arguments.</dd>
+</dl>
+
+<dl>
+ <dt><code>statements</code></dt>
+ <dd>The statements comprising the body of the function.</dd>
+</dl>
+
+<h3 id="The_generator_function_expression_(function*_expression)">The generator function expression (<code>function*</code> expression)</h3>
+
+<div class="note">
+<p><strong>Note:</strong> Generator function are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<p>A generator function expression is similar to and has the same syntax as a generator function declaration (see {{jsxref('Operators/function*', 'function* expression')}} for details):</p>
+
+<pre class="syntaxbox">function* [<em>name</em>]([<em>param</em>] [, <em>param</em>] [..., <em>param</em>]) {
+ <em>statements</em>
+}
+</pre>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The function name. Can be omitted, in which case the function becomes known as an anonymous function.</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>The name of an argument to be passed to the function. A function can have up to 255 arguments.</dd>
+ <dt><code>statements</code></dt>
+ <dd>The statements which comprise the body of the function.</dd>
+</dl>
+
+<h3 id="箭頭函式_The_arrow_function_expression_(>)">箭頭函式 The arrow function expression (=&gt;)</h3>
+
+<div class="note">
+<p><strong>Note:</strong> Arrow function expressions are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<p>An arrow function expression has a shorter syntax and lexically binds its this value (see <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow functions</a> for details):</p>
+
+<pre class="syntaxbox">([param] [, param]) =&gt; {
+ statements
+}
+
+param =&gt; expression
+</pre>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>The name of an argument. Zero arguments need to be indicated with <code>()</code>.  For only one argument the parentheses are not required. (like <code>foo =&gt; 1</code>)</dd>
+ <dt><code>statements or expression</code></dt>
+ <dd>Multiple statements need to be enclosed in brackets. A single expression requires no brackets. The expression is also the implicit return value of that function.</dd>
+</dl>
+
+<h3 id="The_Function_constructor">The <code>Function</code> constructor</h3>
+
+<div class="note">
+<p><strong>Note:</strong> Using the <code>Function</code> constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.</p>
+</div>
+
+<p>As all other objects, {{jsxref("Function")}} objects can be created using the <code>new</code> operator:</p>
+
+<pre class="syntaxbox">new Function (<em>arg1</em>, <em>arg2</em>, ... <em>argN</em>, <em>functionBody</em>)
+</pre>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>Zero or more names to be used by the function as formal argument names. Each must be a string that conforms to the rules for a valid JavaScript identifier or a list of such strings separated with a comma; for example "<code>x</code>", "<code>theValue</code>", or "<code>a,b</code>".</dd>
+</dl>
+
+<dl>
+ <dt><code>functionBody</code></dt>
+ <dd>A string containing the JavaScript statements comprising the function definition.</dd>
+</dl>
+
+<p>Invoking the <code>Function</code> constructor as a function (without using the <code>new</code> operator) has the same effect as invoking it as a constructor.</p>
+
+<h3 id="The_GeneratorFunction_constructor">The <code>GeneratorFunction</code> constructor</h3>
+
+<div class="note">
+<p><strong>Note:</strong> Arrow function expressions are an <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<div class="note">
+<p><strong>Note:</strong> <code>GeneratorFunction</code> is not a global object, but could be obtained from generator function instance (see {{jsxref("GeneratorFunction")}} for more detail).</p>
+</div>
+
+<div class="note">
+<p><strong>Note:</strong> Using the <code>GeneratorFunction</code> constructor to create functions is not recommended since it needs the function body as a string which may prevent some JS engine optimizations and can also cause other problems.</p>
+</div>
+
+<p>As all other objects, {{jsxref("GeneratorFunction")}} objects can be created using the <code>new</code> operator:</p>
+
+<pre class="syntaxbox">new GeneratorFunction (<em>arg1</em>, <em>arg2</em>, ... <em>argN</em>, <em>functionBody</em>)
+</pre>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>Zero or more names to be used by the function as formal argument names. Each must be a string that conforms to the rules for a valid JavaScript identifier or a list of such strings separated with a comma; for example "<code>x</code>", "<code>theValue</code>", or "<code>a,b</code>".</dd>
+</dl>
+
+<dl>
+ <dt><code>functionBody</code></dt>
+ <dd>A string containing the JavaScript statements comprising the function definition.</dd>
+</dl>
+
+<p>Invoking the <code>Function</code> constructor as a function (without using the <code>new</code> operator) has the same effect as invoking it as a constructor.</p>
+
+<h2 id="Function_parameters">Function parameters</h2>
+
+<div class="note">
+<p><strong>Note:</strong> Default and rest parameters are <em>experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<h3 id="Default_parameters">Default parameters</h3>
+
+<p>Default function parameters allow formal parameters to be initialized with default values if no value or <code>undefined</code> is passed. For more details, see<a href="/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters"> default parameters</a>.</p>
+
+<h3 id="Rest_parameters">Rest parameters</h3>
+
+<p>The rest parameter syntax allows to represent an indefinite number of arguments as an array. For more details, see <a href="/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest parameters</a>.</p>
+
+<h2 id="The_arguments_object">The <code>arguments</code> object</h2>
+
+<p>You can refer to a function's arguments within the function by using the <code>arguments</code> object. See <a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments">arguments</a>.</p>
+
+<ul>
+ <li><code><a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments">arguments</a></code>: An array-like object containing the arguments passed to the currently executing function.</li>
+ <li><code><a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments/callee">arguments.callee</a></code> {{Deprecated_inline}}: The currently executing function.</li>
+ <li><code><a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments/caller">arguments.caller</a></code> {{Obsolete_inline}} : The function that invoked the currently executing function.</li>
+ <li><code><a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments/length">arguments.length</a></code>: The number of arguments passed to the function.</li>
+</ul>
+
+<h2 id="Defining_method_functions">Defining method functions</h2>
+
+<h3 id="Getter_and_setter_functions">Getter and setter functions</h3>
+
+<p>You can define getters (accessor methods) and setters (mutator methods) on any standard built-in object or user-defined object that supports the addition of new properties. The syntax for defining getters and setters uses the object literal syntax.</p>
+
+<dl>
+ <dt><a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">get</a></dt>
+ <dd>
+ <p>Binds an object property to a function that will be called when that property is looked up.</p>
+ </dd>
+ <dt><a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">set</a></dt>
+ <dd>Binds an object property to a function to be called when there is an attempt to set that property.</dd>
+</dl>
+
+<h3 id="Method_definition_syntax">Method definition syntax</h3>
+
+<div class="note">
+<p><strong>Note:</strong> <em>Method definitions are experimental technology,</em> part of the ECMAScript 6 proposal, and are not widely supported by browsers yet.</p>
+</div>
+
+<p>Starting with ECMAScript 6, you are able to define own methods in a shorter syntax, similar to the getters and setters. See <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">method definitions</a> for more information.</p>
+
+<pre class="brush: js">var obj = {
+ foo() {},
+  bar() {}
+};</pre>
+
+<h2 id="Function_constructor_vs._function_declaration_vs._function_expression"><code>Function</code> constructor vs. function declaration vs. function expression</h2>
+
+<p>Compare the following:</p>
+
+<p>A function defined with the <code>Function</code> constructor assigned to the variable <code>multiply</code></p>
+
+<pre class="brush: js">function multiply(x, y) {
+ return x * y;
+}
+</pre>
+
+<p>A <em>function expression</em> of an anonymous function assigned to the variable <code>multiply</code></p>
+
+<pre class="brush: js">var multiply = function(x, y) {
+ return x * y;
+};
+</pre>
+
+<p>A <em>function expression</em> of a function named <code>func_name</code> assigned to the variable <code>multiply</code></p>
+
+<pre class="brush: js">var multiply = function func_name(x, y) {
+ return x * y;
+};
+</pre>
+
+<h3 id="Differences">Differences</h3>
+
+<p>All do approximately the same thing, with a few subtle differences:</p>
+
+<p>There is a distinction between the function name and the variable the function is assigned to. The function name cannot be changed, while the variable the function is assigned to can be reassigned. The function name can be used only within the function's body. Attempting to use it outside the function's body results in an error (or <code>undefined</code> if the function name was previously declared via a <code>var</code> statement). For example:</p>
+
+<pre class="brush: js">var y = function x() {};
+alert(x); // throws an error
+</pre>
+
+<p>The function name also appears when the function is serialized via <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString"><code>Function</code>'s toString method</a>.</p>
+
+<p>On the other hand, the variable the function is assigned to is limited only by its scope, which is guaranteed to include the scope where the function is declared in.</p>
+
+<p>As the 4th example shows, the function name can be different from the variable the function is assigned to. They have no relation to each other.A function declaration also creates a variable with the same name as the function name. Thus, unlike those defined by function expressions, functions defined by function declarations can be accessed by their name in the scope they were defined in:</p>
+
+<p>A function defined by '<code>new Function'</code> does not have a function name. However, in the <a href="/en-US/docs/Mozilla/Projects/SpiderMonkey">SpiderMonkey</a> JavaScript engine, the serialized form of the function shows as if it has the name "anonymous". For example, <code>alert(new Function())</code> outputs:</p>
+
+<pre class="brush: js">function anonymous() {
+}
+</pre>
+
+<p>Since the function actually does not have a name, <code>anonymous</code> is not a variable that can be accessed within the function. For example, the following would result in an error:</p>
+
+<pre class="brush: js">var foo = new Function("alert(anonymous);");
+foo();
+</pre>
+
+<p>Unlike functions defined by function expressions or by the <code>Function</code> constructor, a function defined by a function declaration can be used before the function declaration itself. For example:</p>
+
+<pre class="brush: js">foo(); // alerts FOO!
+function foo() {
+ alert('FOO!');
+}
+</pre>
+
+<p>A function defined by a function expression inherits the current scope. That is, the function forms a closure. On the other hand, a function defined by a <code>Function</code> constructor does not inherit any scope other than the global scope (which all functions inherit).</p>
+
+<p>Functions defined by function expressions and function declarations are parsed only once, while those defined by the <code>Function</code> constructor are not. That is, the function body string passed to the <code>Function</code> constructor must be parsed each and every time the constructor is called. Although a function expression creates a closure every time, the function body is not reparsed, so function expressions are still faster than "<code>new Function(...)</code>". Therefore the <code>Function</code> constructor should generally be avoided whenever possible.</p>
+
+<p>It should be noted, however, that function expressions and function declarations nested within the function generated by parsing a <code>Function constructor</code> 's string aren't parsed repeatedly. For example:</p>
+
+<pre class="brush: js">var foo = (new Function("var bar = \'FOO!\';\nreturn(function() {\n\talert(bar);\n});"))();
+foo(); // The segment "function() {\n\talert(bar);\n}" of the function body string is not re-parsed.</pre>
+
+<p>A function declaration is very easily (and often unintentionally) turned into a function expression. A function declaration ceases to be one when it either:</p>
+
+<ul>
+ <li>becomes part of an expression</li>
+ <li>is no longer a "source element" of a function or the script itself. A "source element" is a non-nested statement in the script or a function body:</li>
+</ul>
+
+<pre class="brush: js">var x = 0; // source element
+if (x == 0) { // source element
+ x = 10; // not a source element
+ function boo() {} // not a source element
+}
+function foo() { // source element
+ var y = 20; // source element
+ function bar() {} // source element
+ while (y == 10) { // source element
+ function blah() {} // not a source element
+ y++; // not a source element
+ }
+}
+</pre>
+
+<h3 id="Examples">Examples</h3>
+
+<pre class="brush: js">// function declaration
+function foo() {}
+
+// function expression
+(function bar() {})
+
+// function expression
+x = function hello() {}
+
+
+if (x) {
+ // function expression
+ function world() {}
+}
+
+
+// function declaration
+function a() {
+ // function declaration
+ function b() {}
+ if (0) {
+ // function expression
+ function c() {}
+ }
+}
+</pre>
+
+<h2 id="Conditionally_defining_a_function">Conditionally defining a function</h2>
+
+<p>Functions can be conditionally defined using either //function statements// (an allowed extension to the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262 Edition 3</a> standard) or the <code>Function</code> constructor. Please note that such <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=609832">function statements are no longer allowed in ES5 strict</a>. Additionally, this feature does not work consistently cross-browser, so you should not rely on it.</p>
+
+<p>In the following script, the <code>zero</code> function is never defined and cannot be invoked, because '<code>if (0)</code>' evaluates its condition to false:</p>
+
+<pre class="brush: js">if (0) {
+ function zero() {
+ document.writeln("This is zero.");
+ }
+}
+</pre>
+
+<p>If the script is changed so that the condition becomes '<code>if (1)</code>', function <code>zero</code> is defined.</p>
+
+<p>Note: Although this kind of function looks like a function declaration, it is actually an expression (or statement), since it is nested within another statement. See differences between function declarations and function expressions.</p>
+
+<p>Note: Some JavaScript engines, not including <a href="/en-US/docs/SpiderMonkey">SpiderMonkey</a>, incorrectly treat any function expression with a name as a function definition. This would lead to <code>zero</code> being defined, even with the always-false <code>if</code> condition. A safer way to define functions conditionally is to define the function anonymously and assign it to a variable:</p>
+
+<pre class="brush: js">if (0) {
+ var zero = function() {
+ document.writeln("This is zero.");
+ }
+}
+</pre>
+
+<h2 id="Examples_2">Examples</h2>
+
+<h3 id="Returning_a_formatted_number">Returning a formatted number</h3>
+
+<p>The following function returns a string containing the formatted representation of a number padded with leading zeros.</p>
+
+<pre class="brush: js">// This function returns a string padded with leading zeros
+function padZeros(num, totalLen) {
+ var numStr = num.toString(); // Initialize return value as string
+ var numZeros = totalLen - numStr.length; // Calculate no. of zeros
+ for (var i = 1; i &lt;= numZeros; i++) {
+ numStr = "0" + numStr;
+ }
+ return numStr;
+}
+</pre>
+
+<p>The following statements call the padZeros function.</p>
+
+<pre class="brush: js">var result;
+result = padZeros(42,4); // returns "0042"
+result = padZeros(42,2); // returns "42"
+result = padZeros(5,4); // returns "0005"
+</pre>
+
+<h3 id="Determining_whether_a_function_exists">Determining whether a function exists</h3>
+
+<p>You can determine whether a function exists by using the <code>typeof</code> operator. In the following example, a test is peformed to determine if the <code>window</code> object has a property called <code>noFunc</code> that is a function. If so, it is used; otherwise some other action is taken.</p>
+
+<pre class="brush: js"> if ('function' == typeof window.noFunc) {
+ // use noFunc()
+ } else {
+ // do something else
+ }
+</pre>
+
+<p>Note that in the <code>if</code> test, a reference to <code>noFunc</code> is used—there are no brackets "()" after the function name so the actual function is not called.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>ECMAScript 1st Edition.</td>
+ <td>Standard</td>
+ <td>Initial definition. Implemented in JavaScript 1.0</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-13', 'Function Definition')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function-definitions', 'Function definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>New: Arrow functions, Generator functions, default parameters, rest parameters</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#', 'function*')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-arrow-function-definitions', 'Arrow Function Definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Generator function</td>
+ <td>39</td>
+ <td>{{CompatGeckoDesktop("26.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>26</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Arrow function</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoDesktop("22.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Generator function</td>
+ <td>{{CompatUnknown}}</td>
+ <td>39</td>
+ <td>{{CompatGeckoMobile("26.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>26</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Arrow function</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("22.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Statements/function", "function statement")}}</li>
+ <li>{{jsxref("Operators/function", "function expression")}}</li>
+ <li>{{jsxref("Statements/function*", "function* statement")}}</li>
+ <li>{{jsxref("Operators/function*", "function* expression")}}</li>
+ <li>{{jsxref("Function")}}</li>
+ <li>{{jsxref("GeneratorFunction")}}</li>
+ <li>{{jsxref("Functions/Arrow_functions", "Arrow functions")}}</li>
+ <li>{{jsxref("Functions/Default_parameters", "Default parameters")}}</li>
+ <li>{{jsxref("Functions/rest_parameters", "Rest parameters")}}</li>
+ <li>{{jsxref("Functions/arguments", "Arguments object")}}</li>
+ <li>{{jsxref("Functions/get", "getter")}}</li>
+ <li>{{jsxref("Functions/set", "setter")}}</li>
+ <li>{{jsxref("Functions/Method_definitions", "Method definitions")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope" title="JavaScript/Reference/Functions_and_function_scope">Functions and function scope</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html b/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html
new file mode 100644
index 0000000000..15aeef0f00
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/method_definitions/index.html
@@ -0,0 +1,213 @@
+---
+title: 方法定義
+slug: Web/JavaScript/Reference/Functions/Method_definitions
+translation_of: Web/JavaScript/Reference/Functions/Method_definitions
+---
+<div>{{JsSidebar("Functions")}}</div>
+
+<p>自 ECMAScript 2015 開始,引入了一種於物件初始器(objects initializers)中定義方法的簡短語法。是一個將函式指派予方法名稱的簡便方式。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/functions-definitions.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">var obj = {
+ <var>property</var>( <var>parameters…</var> ) {},
+ *<var>generator</var>( <var>parameters…</var> ) {},
+ async property( <var>parameters…</var> ) {},
+ async* generator( <var>parameters…</var> ) {},
+
+ // with computed keys:
+ [property]( <var>parameters…</var> ) {},
+ *[generator]( <var>parameters…</var> ) {},
+ async [property]( <var>parameters…</var> ) {},
+
+ // compare getter/setter syntax:
+ get <var>property</var>() {},
+ set <var>property</var>(<var>value</var>) {}
+};
+</pre>
+
+<h2 id="說明">說明</h2>
+
+<p>這個簡短的語法和在 ECMAScript 2015 引入 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">getter</a> 以及 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a> 類似。</p>
+
+<p>請看以下程式碼:</p>
+
+<pre class="brush: js">var obj = {
+ foo: function() {
+ /* code */
+ },
+ bar: function() {
+ /* code */
+ }
+};
+</pre>
+
+<p>你可以把它縮減為:</p>
+
+<pre class="brush: js">var obj = {
+ foo() {
+ /* code */
+ },
+ bar() {
+ /* code */
+ }
+};
+</pre>
+
+<h3 id="產生器方法">產生器方法</h3>
+
+<p><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/function*">產生器方法</a>(Generator method)也可以透過簡短語法定義之。用的時候:</p>
+
+<ul>
+ <li>簡短語法的星號(*)必須放在產生器方法的屬性名前面。也就是說 <code>* g(){}</code> 能動但 <code>g *(){}</code> 不行;</li>
+ <li>
+ <p>非產生器方法的定義可能不會有 <code>yield</code> 關鍵字。也就是說<a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/Legacy_generator_function">過往的產生器函式</a>動不了、並拋出{{jsxref("SyntaxError")}}。Always use <code>yield</code> in conjunction with the asterisk (*).</p>
+ </li>
+</ul>
+
+<pre class="brush: js;highlight[12]">// Using a named property
+var obj2 = {
+ g: function* () {
+ var index = 0;
+ while (true)
+ yield index++;
+ }
+};
+
+// The same object using shorthand syntax
+var obj2 = {
+ * g() {
+ var index = 0;
+ while (true)
+ yield index++;
+ }
+};
+
+var it = obj2.g();
+console.log(it.next().value); // 0
+console.log(it.next().value); // 1</pre>
+
+<h3 id="Async_方法">Async 方法</h3>
+
+<p>{{jsxref("Statements/async_function", "Async 方法", "", 1)}} 也可以透過簡短語法定義。</p>
+
+<pre class="brush: js;highlight[12]">// Using a named property
+var obj3 = {
+ f: async function () {
+ await some_promise;
+ }
+};
+
+// The same object using shorthand syntax
+var obj3 = {
+ async f() {
+ await some_promise;
+ }
+};
+</pre>
+
+<h3 id="Async_generator_methods">Async generator methods</h3>
+
+<p><a href="/en-US/docs/Web/JavaScript/Reference/Statements/function*">Generator methods</a> can also be {{jsxref("Statements/async_function", "async", "", 1)}}.</p>
+
+<pre class="brush: js">var obj4 = {
+ f: async function* () {
+ yield 1;
+ yield 2;
+ yield 3;
+ }
+};
+
+// The same object using shorthand syntax
+var obj4 = {
+ async* f() {
+ yield 1;
+ yield 2;
+ yield 3;
+ }
+};</pre>
+
+<h3 id="Method_definitions_are_not_constructable">Method definitions are not constructable</h3>
+
+<p>All method definitions are not constructors and will throw a {{jsxref("TypeError")}} if you try to instantiate them.</p>
+
+<pre class="brush: js example-bad">var obj = {
+ method() {}
+};
+new obj.method; // TypeError: obj.method is not a constructor
+
+var obj = {
+ * g() {}
+};
+new obj.g; // TypeError: obj.g is not a constructor (changed in ES2016)
+</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Simple_test_case">Simple test case</h3>
+
+<pre class="brush: js;highlight[3]">var obj = {
+ a: 'foo',
+ b() { return this.a; }
+};
+console.log(obj.b()); // "foo"
+</pre>
+
+<h3 id="Computed_property_names">Computed property names</h3>
+
+<p>The shorthand syntax also supports computed property names.</p>
+
+<pre class="brush: js;highlight[4]">var bar = {
+ foo0: function() { return 0; },
+ foo1() { return 1; },
+ ['foo' + 2]() { return 2; }
+};
+
+console.log(bar.foo0()); // 0
+console.log(bar.foo1()); // 1
+console.log(bar.foo2()); // 2</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2016', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ES2016')}}</td>
+ <td>Changed that generator methods should also not have a [[Construct]] trap and will throw when used with <code>new</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.functions.method_definitions")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/get">get</a></code></li>
+ <li><code><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/set">set</a></code></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Lexical_grammar">Lexical grammar</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/rest_parameters/index.html b/files/zh-tw/web/javascript/reference/functions/rest_parameters/index.html
new file mode 100644
index 0000000000..bed96fff03
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/rest_parameters/index.html
@@ -0,0 +1,155 @@
+---
+title: 其餘參數
+slug: Web/JavaScript/Reference/Functions/rest_parameters
+translation_of: Web/JavaScript/Reference/Functions/rest_parameters
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p><strong>其餘參數(rest parameter)</strong> 語法可以讓我們表示不確定數量的參數,並將其視為一個陣列。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">function f(a, b, ...theArgs) {
+ // ...
+}
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>如果函式的最後一個命名參數以 <code>...</code> 開頭,它會被視為一個陣列。該陣列的元素會被置於索引從 <code>0</code>(含)到的 <code>theArgs.length</code>(不含)位置,並且被視為一個函式的參數。</p>
+
+<p>在上面的範例中,<code>theArgs</code> 會將函式f中第三個(含)以後的參數收集起來。</p>
+
+<h3 id="其餘參數和_arguments_物件的差異">其餘參數和 <code>arguments</code> 物件的差異</h3>
+
+<p>以下是其餘參數和 <code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments" title="arguments">arguments</a> 物件</code>三個主要的差異:</p>
+
+<ul>
+ <li>其餘參數是 <code>arguments</code> 物件被傳入到函式的時候,還沒被指定變數名稱的引數。</li>
+ <li><code>arguments</code> 物件不是一個實際的陣列,而 rest parameter 是陣列的實體,即 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort" title="Array sort method">sort</a></code>、<code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" title="Array map method">map</a></code><font face="Open Sans, arial, x-locale-body, sans-serif">、</font><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" title="Array forEach method">forEach</a></code> <font face="Open Sans, arial, x-locale-body, sans-serif">或 </font><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop" title="Array pop method">pop</a></code> 可以直接在其餘參數被調用。</li>
+ <li><code>arguments</code> 物件自身有額外的功能,例如 <code>callee</code> 屬性。</li>
+</ul>
+
+<h3 id="將參數轉成陣列">將參數轉成陣列</h3>
+
+<p>其餘參數被介紹作為取代用 arguments 寫的範例程式。</p>
+
+<pre class="brush: js">// 在有其餘參數之前,你可能見過下面的程式碼:
+function f(a, b) {
+ var args = Array.prototype.slice.call(arguments, f.length); // f.length 表示 arguments 的數量
+
+ // …
+}
+
+// 現在可以寫成這樣
+
+function f(a, b, ...args) {
+
+}
+</pre>
+
+<h3 id="解構其餘參數_rest_parameters">解構其餘參數 rest parameters</h3>
+
+<p>其餘參數可以被解構,換句話說,可以把這個陣列解開,並將各個元素取出成為個別的變數。請參考<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解構賦值</a>。</p>
+
+<pre class="brush: js">function f(...[a, b, c]) {
+ return a + b + c;
+}
+
+f(1) // NaN (b 和 c 都是 undefined)
+f(1, 2, 3) // 6
+f(1, 2, 3, 4) // 6 (第四個參數不會被解構,因為解構式只有三個定義好的變數名稱)</pre>
+
+<h2 id="範例">範例</h2>
+
+<p>因為 <code>theArgs</code> 是一個陣列,所以它會有 <code>length</code> 屬性,作為表示參數數量:</p>
+
+<pre class="brush: js">function fun1(...theArgs) {
+ console.log(theArgs.length);
+}
+
+fun1(); // 0
+fun1(5); // 1
+fun1(5, 6, 7); // 3
+</pre>
+
+<p>在接下來的範例中,其餘參數被用來收集第一個之後的所有引數並存在陣列中。 在這個陣列裡的每個元素(數字),都會和第一個參數相乘後取代原本的元素,最後再將取代元素後的陣列回傳。</p>
+
+<pre class="brush: js">function multiply(multiplier, ...theArgs) {
+ return theArgs.map(function(element) {
+ return multiplier * element;
+ });
+}
+
+var arr = multiply(2, 1, 2, 3);
+console.log(arr); // [2, 4, 6]
+</pre>
+
+<p>下列範例展示 <code>Array</code> 的方法可以在其餘參數上被使用,但 <code>arguments</code> 則不行。</p>
+
+<pre class="brush: js">function sortRestArgs(...theArgs) {
+ var sortedArgs = theArgs.sort();
+ return sortedArgs;
+}
+
+console.log(sortRestArgs(5, 3, 7, 1)); // 顯示 1, 3, 5, 7
+
+function sortArguments() {
+ var sortedArgs = arguments.sort();
+ return sortedArgs; // 因為前一行會因為 arguments 沒有sort()這個方法而造成TypeError,所以永遠不會執行此行。
+}
+
+console.log(sortArguments(5, 3, 7, 1)); // 會拋出 TypeError (arguments.sort is not a function)
+</pre>
+
+<p>為了要在 <code>arguments</code> 物件上使用 <code>Array</code> 的方法,可以將它轉換成真的 <code>Array</code> 實體,或者以 <code>apply()</code> 直接調用需要的方法。</p>
+
+<pre class="brush: js">function sortArguments() {
+ var args = Array.from(arguments);
+ var sortedArgs = args.sort();
+ return sortedArgs;
+}
+console.log(sortArguments(5, 3, 7, 1)); // 顯示 1, 3, 5, 7
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function-definitions', 'Function Definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-definitions', 'Function Definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.functions.rest_parameters")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator" title="spread operator">Spread operator</a> (also ‘<code>...</code>’)</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments" title="arguments">Arguments object</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" title="Array">Array</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions" title="Functions and function scope">Functions</a></li>
+ <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:rest_parameters">Original proposal at ecmascript.org</a></li>
+ <li><a class="external" href="http://javascriptweblog.wordpress.com/2011/01/18/javascripts-arguments-object-and-beyond/">JavaScript arguments object and beyond</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">Destructuring assignment</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/functions/set/index.html b/files/zh-tw/web/javascript/reference/functions/set/index.html
new file mode 100644
index 0000000000..171d366eb9
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/functions/set/index.html
@@ -0,0 +1,138 @@
+---
+title: setter
+slug: Web/JavaScript/Reference/Functions/set
+translation_of: Web/JavaScript/Reference/Functions/set
+---
+<div>{{jsSidebar("Functions")}}</div>
+
+<p><strong><code>set</code></strong> 語法會在物件屬性被嘗試定義時,將其屬性綁定到要呼叫的函式內。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/functions-setter.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">{set <em>prop</em>(<em>val</em>) { . . . }}
+{set [expression](<em>val</em>) { . . . }}</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>prop</code></dt>
+ <dd>要綁定到給定函式的屬性名。</dd>
+ <dt><code>val</code></dt>
+ <dd>變數別名,該變數擁有要被嘗試安插到 <code>prop</code> 的數值。</dd>
+ <dt>expression</dt>
+ <dd>從 ECMAScript 2015 開始,可以使用計算屬性名(computed property name)表達式,綁定到給定函式。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>JavaScript 的 setter 能在嘗試修改指定屬性時,執行給定函式。Setter 最常用於和 getter 一同建立虛擬屬性(pseudo-property)。你不可能給同一個屬性賦予 setter 與實際值。</p>
+
+<p>使用 <code>set</code> 語法時,請注意以下情況:</p>
+
+<div>
+<ul>
+ <li>可以擁有一個以數字或字串為代表的標示符;</li>
+ <li>最少要有一個參數(請參見 <a class="external" href="http://whereswalden.com/2010/08/22/incompatible-es5-change-literal-getter-and-setter-functions-must-now-have-exactly-zero-or-one-arguments/" rel="external nofollow">Incompatible <abbr title="ECMAScript 5th edition">ES5</abbr> change: literal getter and setter functions must now have exactly zero or one arguments</a> 的詳細資料);</li>
+ <li>不能以有另一個 <code>set</code> 的 object literal、或相同屬性入口(data entry)的 data 形式出現(不能使用 <code>{ set x(v) { }, set x(v) { } }</code> and <code>{ x: ..., set x(v) { } }</code>)</li>
+</ul>
+</div>
+
+<p><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/delete" title="zh-TW/docs/JavaScript/Reference/Operators/Special/delete"><code>delete</code></a> 操作符可移除 setter。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="在物件初始器的新物件定義_setter">在物件初始器的新物件定義 setter</h3>
+
+<p>這裡會給物件 <code>language</code> 定義稱為 <code>current</code> 的虛擬屬性。在指派數值時 <code>log</code> 會和該值一同更新:</p>
+
+<pre class="brush: js">var language = {
+ set current(name) {
+ this.log.push(name);
+ },
+ log: []
+}
+
+language.current = 'EN';
+console.log(language.log); // ['EN']
+
+language.current = 'FA';
+console.log(language.log); // ['EN', 'FA']
+</pre>
+
+<p>請注意 <code>current</code> is not defined and any attempts to access it will result in <code>undefined</code>.</p>
+
+<h3 id="使用_delete_操作符移除_setter">使用 <code>delete</code> 操作符移除 setter</h3>
+
+<p>若想移除 setter 的話,可以直接使用 <code><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/delete">delete</a></code>:</p>
+
+<pre class="brush: js">delete o.current;
+</pre>
+
+<h3 id="針對已存在屬性的_setter_使用_defineProperty">針對已存在屬性的 setter 使用 <code>defineProperty</code></h3>
+
+<p>To append a setter to an existing object later at any time, use {{jsxref("Object.defineProperty()")}}.</p>
+
+<pre class="brush: js">var o = {a: 0};
+
+Object.defineProperty(o, 'b', { set: function(x) { this.a = x / 2; } });
+
+o.b = 10; // Runs the setter, which assigns 10 / 2 (5) to the 'a' property
+console.log(o.a) // 5</pre>
+
+<h3 id="使用計算屬性名">使用計算屬性名</h3>
+
+<pre class="brush: js">var expr = 'foo';
+
+var obj = {
+ baz: 'bar',
+ set [expr](v) { this.baz = v; }
+};
+
+console.log(obj.baz); // "bar"
+obj.foo = 'baz'; // 跑 setter
+console.log(obj.baz); // "baz"
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.1.5', 'Object Initializer')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初始定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>增加計算屬性名。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-method-definitions', 'Method definitions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{Compat("javascript.functions.set")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/get">getter</a></li>
+ <li>{{jsxref("Operators/delete", "delete")}}</li>
+ <li>{{jsxref("Object.defineProperty()")}}</li>
+ <li>{{jsxref("Object.defineGetter", "__defineGetter__")}}</li>
+ <li>{{jsxref("Object.defineSetter", "__defineSetter__")}}</li>
+ <li>JavaScript 教學的<a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">定義 Getters 與 Setters</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/@@iterator/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/@@iterator/index.html
new file mode 100644
index 0000000000..eb73724bef
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/@@iterator/index.html
@@ -0,0 +1,89 @@
+---
+title: 'Array.prototype[@@iterator]()'
+slug: Web/JavaScript/Reference/Global_Objects/Array/@@iterator
+tags:
+ - Array
+ - ECMAScript 2015
+ - Iterator
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@iterator
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>@@iterator</strong></code> 屬性的初始值與 {{jsxref("Array.prototype.values()", "values()")}} 屬性的初始值為相同的的函式物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><var>arr</var>[Symbol.iterator]()</code></pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>陣列的<strong>迭代器(iterator)</strong>函式,預設與 {{jsxref("Array.prototype.values()", "values()")}} 函式相同。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_for...of_迴圈進行迭代">使用 <code>for...of</code> 迴圈進行迭代</h3>
+
+<pre class="brush: js">var arr = ['w', 'y', 'k', 'o', 'p'];
+var eArr = arr[Symbol.iterator]();
+// your browser must support for..of loop
+// and let-scoped variables in for loops
+for (let letter of eArr) {
+ console.log(letter);
+}
+</pre>
+
+<h3 id="另一種迭代方式">另一種迭代方式</h3>
+
+<pre class="brush: js">var arr = ['w', 'y', 'k', 'o', 'p'];
+var eArr = arr[Symbol.iterator]();
+console.log(eArr.next().value); // w
+console.log(eArr.next().value); // y
+console.log(eArr.next().value); // k
+console.log(eArr.next().value); // o
+console.log(eArr.next().value); // p
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.@@iterator")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.keys()")}}</li>
+ <li>{{jsxref("Array.prototype.entries()")}}</li>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li>{{jsxref("Array.prototype.values()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html
new file mode 100644
index 0000000000..c8fc9a7aca
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/concat/index.html
@@ -0,0 +1,157 @@
+---
+title: Array.prototype.concat()
+slug: Web/JavaScript/Reference/Global_Objects/Array/concat
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/concat
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>concat()</strong></code> 方法被用來合併兩個或多個陣列。此方法不會改變現有的陣列,回傳一個包含呼叫者陣列本身的值,作為代替的是回傳一個新陣列。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-concat.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">var <var>new_array</var> = <var>old_array</var>.concat(<var>value1</var>[, <var>value2</var>[, ...[, <var>valueN</var>]]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value<em>N</em></code></dt>
+ <dd>陣列以及/或者值,用來合併成一個新的陣列。請參閱下方詳細資訊描述。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的{{jsxref("Array","陣列")}}實體。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>concat</code> 產生一個由呼叫者陣列自己的元素,以及對每一個參數按照順序,合併參數的元素(如果參數是個陣列)或者是參數自己本身(如果參數不是一個陣列)成為一個新的陣列。<code>concat</code> 方法不會遞迴巢狀陣列參數。</p>
+
+<p><code>concat</code> 方法不會改變 <code>this</code> 自己本身或是任何被提供當做參數的陣列,取而代之則是回傳一個淺層複製(shallow copy)包含了與原始的陣列中一樣的元素的副本。原始陣列的元素被複製到新的陣列的規則如下所示:</p>
+
+<ul>
+ <li>物件參考(並非為實際的物件):<code>concat</code> 複製物件的參考至新的陣列。不管是原始的還是新的陣列都參考到相同的物件。也就是說,如果一個被參照的物件被修改了,變動會同時反映到新的以及原始的陣列中。</li>
+ <li>資料型態為字串、數值或是布林(非 {{jsxref("Global_Objects/String", "String")}}、{{jsxref("Global_Objects/Number", "Number")}} 及 {{jsxref("Global_Objects/Boolean", "Boolean")}} 物件):<code>concat</code> 複製字串及數值的值到新的陣列。</li>
+</ul>
+
+<div class="note">
+<p><strong>備註:</strong>合併(多個)陣列/(多個)值將讓原始的陣列不會被受到影響。此外,任何對新陣列(只有在元素不是物件參考的情況下)的操作都不會影響原始的陣列,反之亦然。</p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="合併兩個陣列">合併兩個陣列</h3>
+
+<p>下面的程式碼為合併兩個陣列:</p>
+
+<pre class="brush: js">var alpha = ['a', 'b', 'c'];
+var numeric = [1, 2, 3];
+
+alpha.concat(numeric);
+// 結果: ['a', 'b', 'c', 1, 2, 3]
+</pre>
+
+<h3 id="合併三個陣列">合併三個陣列</h3>
+
+<p>下面的程式碼為合併三個陣列:</p>
+
+<pre class="brush: js">var num1 = [1, 2, 3],
+ num2 = [4, 5, 6],
+ num3 = [7, 8, 9];
+
+var nums = num1.concat(num2, num3);
+
+console.log(nums);
+// 結果:[1, 2, 3, 4, 5, 6, 7, 8, 9]
+</pre>
+
+<h3 id="合併值到一個陣列">合併值到一個陣列</h3>
+
+<p>下面的程式碼為合併三個值到一個陣列中:</p>
+
+<pre class="brush: js">var alpha = ['a', 'b', 'c'];
+
+var alphaNumeric = alpha.concat(1, [2, 3]);
+
+console.log(alphaNumeric);
+// 結果:['a', 'b', 'c', 1, 2, 3]
+</pre>
+
+<h3 id="合併巢狀陣列">合併巢狀陣列</h3>
+
+<p>下面的程式碼為合併巢狀陣列,並證明保留了原本的參考(references):</p>
+
+<pre class="brush: js">var num1 = [[1]];
+var num2 = [2, [3]];
+
+var nums = num1.concat(num2);
+
+console.log(nums);
+// results in [[1], 2, [3]]
+
+// modify the first element of num1
+num1[0].push(4);
+
+console.log(nums);
+// results in [[1, 4], 2, [3]]
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>首次定義。實作於 JavaScript 1.2。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.4', 'Array.prototype.concat')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.concat', 'Array.prototype.concat')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.concat', 'Array.prototype.concat')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.concat")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.push", "push")}} / {{jsxref("Array.pop", "pop")}} — 從陣列的尾端加入/移除元素</li>
+ <li>{{jsxref("Array.unshift", "unshift")}} / {{jsxref("Array.shift", "shift")}} — 從陣列的前端加入/移除元素</li>
+ <li>{{jsxref("Array.splice", "splice")}} — 從陣列特定的位置加入/移除元素</li>
+ <li>{{jsxref("String.prototype.concat()")}}</li>
+ <li>{{jsxref("Symbol.isConcatSpreadable")}} – 控制扁平化</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html
new file mode 100644
index 0000000000..30520215e3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/copywithin/index.html
@@ -0,0 +1,156 @@
+---
+title: Array.prototype.copyWithin()
+slug: Web/JavaScript/Reference/Global_Objects/Array/copyWithin
+tags:
+ - Array
+ - ECMAScript 2015
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/copyWithin
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>copyWithin()</strong></code> 方法會對陣列的一部分進行淺拷貝至同一陣列的另一位置並回傳此陣列,而不修改其大小。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-copywithin.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.copyWithin(<var>target</var>)
+<var>arr</var>.copyWithin(<var>target</var>, <var>start</var>)
+<var>arr</var>.copyWithin(<var>target</var>, <var>start</var>, <var>end</var>)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>target</code></dt>
+ <dd>要複製序列(sequence)至該位置的索引(起始為 0)。若為負數,<code>target</code> 將會自陣列末項開始計算。</dd>
+ <dd>假如 <code>target</code> 大於等於 <code>arr.length</code>,則沒有項目會被複製。如果 <code>target</code> 的索引在 <code>start</code> 之後,則拷貝的序列將會被修剪以符合 <code>arr.length</code>。</dd>
+ <dt><code>start</code> {{optional_inline}}</dt>
+ <dd>開始拷貝的起始元素索引(起始為 0)。若為負數,<code>start</code> 將會自陣列末項開始計算。</dd>
+ <dd>如果省略 <code>start</code>,<code>copyWithin</code> 將會自陣列首項開始複製(預設為 0)。</dd>
+ <dt><code>end</code> {{optional_inline}}</dt>
+ <dd>結束拷貝的結尾元素索引(起始為 0)。<code>copyWithin</code> 會拷貝至此索引,但不包含 <code>end</code>。若為負數,<code>end</code> 將會自陣列末項開始計算。</dd>
+ <dd>如果省略 <code>end</code>,<code>copyWithin</code> 將會一路拷貝至陣列末項(預設至 <code>arr.length</code>)。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>被修改後的陣列。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>The <code>copyWithin</code> works like C and C++'s <code>memmove</code>, and is a high-performance method to shift the data of an {{jsxref("Array")}}. This especially applies to the {{jsxref("TypedArray/copyWithin", "TypedArray")}} method of the same name. The sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap.</p>
+
+<p>The <code>copyWithin</code> function is intentionally <em>generic</em>, it does not require that its this value be an {{jsxref("Array")}} object.</p>
+
+<p>The <code>copyWithin</code> method is a mutable method. It does not alter the length of <code>this</code>, but will change its content and create new properties if necessary.</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">[1, 2, 3, 4, 5].copyWithin(-2);
+// [1, 2, 3, 1, 2]
+
+[1, 2, 3, 4, 5].copyWithin(0, 3);
+// [4, 5, 3, 4, 5]
+
+[1, 2, 3, 4, 5].copyWithin(0, 3, 4);
+// [4, 2, 3, 4, 5]
+
+[1, 2, 3, 4, 5].copyWithin(-2, -3, -1);
+// [1, 2, 3, 3, 4]
+
+[].copyWithin.call({length: 5, 3: 1}, 0, 3);
+// {0: 1, 3: 1, length: 5}
+
+// ES2015 Typed Arrays are subclasses of Array
+var i32a = new Int32Array([1, 2, 3, 4, 5]);
+
+i32a.copyWithin(0, 2);
+// Int32Array [3, 4, 5, 4, 5]
+
+// On platforms that are not yet ES2015 compliant:
+[].copyWithin.call(new Int32Array([1, 2, 3, 4, 5]), 0, 3, 4);
+// Int32Array [4, 2, 3, 4, 5]
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">if (!Array.prototype.copyWithin) {
+  Array.prototype.copyWithin =
+  // Array: Number[, Number[, Number]]
+  function copyWithin(target, start, stop) {
+    var positiveT = target &gt;= 0,
+        positiveS = (start = start | 0) &gt;= 0,
+        length    = this.length,
+        zero      = 0,
+        r         = function() {return ((+new Date) * Math.random()).toString(36)},
+        delimiter = "\b" + r() + "-" + r() + "-" + r() + "\b",
+        hold;
+
+    stop = stop || this.length;
+    hold = this.slice.apply(this,
+      positiveT?
+        [start, stop]:
+      positiveS?
+        [start, -target]:
+      [start])
+    .join(delimiter);
+
+    return this.splice.apply(this,
+      positiveT?
+        [target, stop - start, hold]:
+      positiveS?
+        [target, stop, hold]:
+      [target, start, hold]),
+            this.join(delimiter).split(delimiter).slice(zero, length);
+  }
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.copywithin', 'Array.prototype.copyWithin')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2016', '#sec-array.prototype.copywithin', 'Array.prototype.copyWithin')}}</td>
+ <td>{{Spec2('ES2016')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.copywithin', 'Array.prototype.copyWithin')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.copyWithin")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/entries/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/entries/index.html
new file mode 100644
index 0000000000..80c3f33e1f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/entries/index.html
@@ -0,0 +1,86 @@
+---
+title: Array.prototype.entries()
+slug: Web/JavaScript/Reference/Global_Objects/Array/entries
+tags:
+ - Array
+ - ECMAScript6
+ - Iterator
+ - JavaScript
+ - Method
+ - Prototype
+ - 迭代器
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/entries
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>entries()</strong></code> 方法會回傳一個包含陣列中每一個索引之鍵值對(key/value pairs)的新陣列迭代器(<code><strong>Array Iterator</strong></code>)物件。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-entries.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>a</var>.entries()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 {{jsxref("Array")}} 迭代器物件。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_for…of_進行迭代">使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of">for…of</a> 進行迭代</h3>
+
+<pre class="brush:js">var a = ['a', 'b', 'c'];
+var iterator = a.entries();
+
+for (let e of iterator) {
+ console.log(e);
+}
+// [0, 'a']
+// [1, 'b']
+// [2, 'c']
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.entries', 'Array.prototype.entries')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>首次定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.entries', 'Array.prototype.entries')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.entries")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.keys()")}}</li>
+ <li>{{jsxref("Array.prototype.values()")}}</li>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of">for...of</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols">迭代協議</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/every/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/every/index.html
new file mode 100644
index 0000000000..3c0aa59938
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/every/index.html
@@ -0,0 +1,191 @@
+---
+title: Array.prototype.every()
+slug: Web/JavaScript/Reference/Global_Objects/Array/every
+tags:
+ - Array
+ - ECMAScript 5
+ - JavaScript
+ - Method
+ - Prototype
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/every
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>every()</strong></code> 方法會測試陣列中的所有元素是否都通過了由給定之函式所實作的測試。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-every.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.every(<var>callback</var>[, <var>thisArg</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>用來測試每一個元素的函式,它包含三個引數:
+ <dl>
+ <dt><code>currentValue</code>(必要的)</dt>
+ <dd>目前正要被處理的陣列元素。</dd>
+ <dt><code>index</code>(可選的)</dt>
+ <dd>目前正要被處理的陣列元素之索引值。</dd>
+ <dt><code>array</code>(可選的)</dt>
+ <dd>呼叫 <code>every</code> 的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code></dt>
+ <dd>可選的。執行 <code>callback</code> 回呼函式的 <code>this</code> 值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>若回呼函式在處理每一個陣列元素時皆得到 {{Glossary("truthy")}} 值,則回傳 <code><strong>true</strong></code>。否則,回傳值為 <code><strong>false</strong></code>。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>The <code>every</code> method executes the provided <code>callback</code> function once for each element present in the array until it finds one where <code>callback</code> returns a {{Glossary("falsy")}} value. If such an element is found, the <code>every</code> method immediately returns <code>false</code>. Otherwise, if <code>callback</code> returns a {{Glossary("truthy")}} value for all elements, <code>every</code> returns <code>true</code>. <code>callback</code> is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.</p>
+
+<p><code>callback</code> is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.</p>
+
+<p>If a <code>thisArg</code> parameter is provided to <code>every</code>, it will be used as callback's <code>this</code> value. Otherwise, the value <code>undefined</code> will be used as its <code>this</code> value.  The <code>this</code> value ultimately observable by <code>callback</code> is determined according to <a href="/en-US/docs/Web/JavaScript/Reference/Operators/this">the usual rules for determining the <code>this</code> seen by a function</a>.</p>
+
+<p><code>every</code> does not mutate the array on which it is called.</p>
+
+<p>The range of elements processed by <code>every</code> is set before the first invocation of <code>callback</code>. Elements which are appended to the array after the call to <code>every</code> begins will not be visited by <code>callback</code>. If existing elements of the array are changed, their value as passed to <code>callback</code> will be the value at the time <code>every</code> visits them; elements that are deleted are not visited.</p>
+
+<p><code>every</code> acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. (It is <a href="http://en.wikipedia.org/wiki/Vacuous_truth#Vacuous_truths_in_mathematics">vacuously true</a> that all elements of the <a href="http://en.wikipedia.org/wiki/Empty_set#Common_problems">empty set</a> satisfy any given condition.)</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Testing_size_of_all_array_elements">Testing size of all array elements</h3>
+
+<p>The following example tests whether all elements in the array are bigger than 10.</p>
+
+<pre class="brush: js">function isBigEnough(element, index, array) {
+ return element &gt;= 10;
+}
+[12, 5, 8, 130, 44].every(isBigEnough); // false
+[12, 54, 18, 130, 44].every(isBigEnough); // true
+</pre>
+
+<h3 id="Using_arrow_functions">Using arrow functions</h3>
+
+<p><a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a> provide a shorter syntax for the same test.</p>
+
+<pre class="brush: js">[12, 5, 8, 130, 44].every(x =&gt; x &gt;= 10); // false
+[12, 54, 18, 130, 44].every(x =&gt; x &gt;= 10); // true</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>every</code> was added to the ECMA-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of <code>every</code> in implementations which do not natively support it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming <code>Object</code> and <code>TypeError</code> have their original values and that <code>callbackfn.call</code> evaluates to the original value of {{jsxref("Function.prototype.call")}}</p>
+
+<pre class="brush: js">if (!Array.prototype.every) {
+ Array.prototype.every = function(callbackfn, thisArg) {
+ 'use strict';
+ var T, k;
+
+ if (this == null) {
+ throw new TypeError('this is null or not defined');
+ }
+
+ // 1. Let O be the result of calling ToObject passing the this
+ // value as the argument.
+ var O = Object(this);
+
+ // 2. Let lenValue be the result of calling the Get internal method
+ // of O with the argument "length".
+ // 3. Let len be ToUint32(lenValue).
+ var len = O.length &gt;&gt;&gt; 0;
+
+ // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
+ if (typeof callbackfn !== 'function') {
+ throw new TypeError();
+ }
+
+ // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ if (arguments.length &gt; 1) {
+ T = thisArg;
+ }
+
+ // 6. Let k be 0.
+ k = 0;
+
+ // 7. Repeat, while k &lt; len
+ while (k &lt; len) {
+
+ var kValue;
+
+ // a. Let Pk be ToString(k).
+ // This is implicit for LHS operands of the in operator
+ // b. Let kPresent be the result of calling the HasProperty internal
+ // method of O with argument Pk.
+ // This step can be combined with c
+ // c. If kPresent is true, then
+ if (k in O) {
+
+ // i. Let kValue be the result of calling the Get internal method
+ // of O with argument Pk.
+ kValue = O[k];
+
+ // ii. Let testResult be the result of calling the Call internal method
+ // of callbackfn with T as the this value and argument list
+ // containing kValue, k, and O.
+ var testResult = callbackfn.call(T, kValue, k, O);
+
+ // iii. If ToBoolean(testResult) is false, return false.
+ if (!testResult) {
+ return false;
+ }
+ }
+ k++;
+ }
+ return true;
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.16', 'Array.prototype.every')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.every', 'Array.prototype.every')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.every', 'Array.prototype.every')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.every")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.every()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/fill/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/fill/index.html
new file mode 100644
index 0000000000..1a7d0f9f24
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/fill/index.html
@@ -0,0 +1,156 @@
+---
+title: Array.prototype.fill()
+slug: Web/JavaScript/Reference/Global_Objects/Array/fill
+tags:
+ - Array
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 填充工具
+ - 方法
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/fill
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>fill()</strong></code> 方法會將陣列中索引的第一個到最後一個的每個位置全部填入一個靜態的值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-fill.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.fill(<var>value[</var>, <var>start[<var>, <var>end]]</var>)</var></var>
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>欲填入陣列的值。</dd>
+ <dt><code>start</code> {{optional_inline}}</dt>
+ <dd>起始的索引值,預設為 0。</dd>
+ <dt><code>end</code> {{optional_inline}}</dt>
+ <dd>結束的索引值,預設為 <code>this.length</code>(即陣列的長度)。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>修改後的陣列。</p>
+
+<h2 id="說明">說明</h2>
+
+<p>要填入的元素區間為 [<code>start</code>, <code>end</code>),意即包含 <code>start</code> 但不包含 <code>end</code>。</p>
+
+<p><strong><code>fill</code></strong> 方法採用了三個傳入引數(arguments),分別為<code>value</code>、<code>start</code> 及 <code>end</code>。<code>start</code> 和 <code>end</code> 為可選引數,其預設值分別為 <code>0</code> 和 <code>this</code> 物件(該陣列)的 <code>length</code>。</p>
+
+<p>若 <code>start</code> 為負數,則此方法會將其換算成 <code>length+start</code>,<code>length</code> 即該陣列的長度。同理,若 <code>end</code> 為負數,其會被換算成 <code>length+end</code>。</p>
+
+<p><strong><code>fill</code></strong> 函式刻意地被設計成通用的函式,它不需要 <code>this</code> 物件一定是一個陣列物件。此外,它是可變動的(mutable)方法,意即會修改 <code>this</code> 物件本身並回傳,而非只是回傳拷貝。</p>
+
+<p>當 <strong><code>fill</code></strong> 方法獲得一個傳入的物件,會將傳入的物件位置進行複製,並把其參考值(reference)之拷貝填入陣列中。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">[1, 2, 3].fill(4); // [4, 4, 4]
+[1, 2, 3].fill(4, 1); // [1, 4, 4]
+[1, 2, 3].fill(4, 1, 2); // [1, 4, 3]
+[1, 2, 3].fill(4, 1, 1); // [1, 2, 3]
+[1, 2, 3].fill(4, 3, 3); // [1, 2, 3]
+[1, 2, 3].fill(4, -3, -2); // [4, 2, 3]
+[1, 2, 3].fill(4, NaN, NaN); // [1, 2, 3]
+[1, 2, 3].fill(4, 3, 5); // [1, 2, 3]
+Array(3).fill(4); // [4, 4, 4]
+[].fill.call({ length: 3 }, 4); // {0: 4, 1: 4, 2: 4, length: 3}
+
+// Objects by reference.
+var arr = Array(3).fill({}) // [{}, {}, {}];
+arr[0].hi = "hi"; // [{ hi: "hi" }, { hi: "hi" }, { hi: "hi" }]
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">if (!Array.prototype.fill) {
+ Object.defineProperty(Array.prototype, 'fill', {
+ value: function(value) {
+
+ // 步驟 1 - 2。
+ if (this == null) {
+ throw new TypeError('this is null or not defined');
+ }
+
+ var O = Object(this);
+
+ // 步驟 3 - 5。
+ var len = O.length &gt;&gt;&gt; 0;
+
+ // 步驟 6 - 7。
+ var start = arguments[1];
+ var relativeStart = start &gt;&gt; 0;
+
+ // 步驟 8。
+ var k = relativeStart &lt; 0 ?
+ Math.max(len + relativeStart, 0) :
+ Math.min(relativeStart, len);
+
+ // 步驟 9 - 10。
+ var end = arguments[2];
+ var relativeEnd = end === undefined ?
+ len : end &gt;&gt; 0;
+
+ // 步驟 11。
+ var final = relativeEnd &lt; 0 ?
+ Math.max(len + relativeEnd, 0) :
+ Math.min(relativeEnd, len);
+
+ // 步驟 12。
+ while (k &lt; final) {
+ O[k] = value;
+ k++;
+ }
+
+ // 步驟 13。
+ return O;
+ }
+ });
+}
+</pre>
+
+<p>如果你需要支援實際上棄用的 JavaScript 引擎且其不支援 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty</a></code> 的話,最好不要採用上述的工具來填充方法至 <code>Array.prototype</code>,因為你不能將這個方法設定為不可列舉(non-enumerable)的屬性。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.fill', 'Array.prototype.fill')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>初次定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.fill', 'Array.prototype.fill')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.fill")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("TypedArray.prototype.fill()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html
new file mode 100644
index 0000000000..49546e6505
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/filter/index.html
@@ -0,0 +1,238 @@
+---
+title: Array.prototype.filter()
+slug: Web/JavaScript/Reference/Global_Objects/Array/filter
+tags:
+ - Array
+ - ECMAScript 5
+ - JavaScript
+ - 原型
+ - 參見
+ - 填充工具
+ - 方法
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/filter
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>filter()</strong></code> 方法會建立一個經指定之函式運算後,由原陣列中通過該函式檢驗之元素所構成的新陣列。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-filter.html")}}</div>
+
+
+
+<h3 id="ES6_版本">ES6 版本</h3>
+
+<pre class="brush: js">const words = ["spray", "limit", "elite", "exuberant", "destruction", "present", "happy"];
+
+let longWords = words.filter(word =&gt; word.length &gt; 6);
+
+// Filtered array longWords is ["exuberant", "destruction", "present"]
+</pre>
+
+<h2 id="語法">語法</h2>
+
+<pre><var>var newArray = arr</var>.filter(<var>callback(element[, index[, array]])</var>[, <var>thisArg</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>此函式為一個斷言,用於測試陣列中的每個元素。回傳值為 <code>true</code> 時將當前的元素保留至新陣列中,若為 <code>false</code> 則不保留。可傳入三個參數:</dd>
+ <dd>
+ <dl>
+ <dt><code>element</code></dt>
+ <dd>原陣列目前所迭代處理中的元素。</dd>
+ <dt><code>index</code>{{optional_inline}}</dt>
+ <dd>原陣列目前所迭代處理中的元素之索引。</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>filter</code> 方法的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code> {{optional_inline}}</dt>
+ <dd>可選的。執行 <code>callback</code> 回呼函式的 <code>this</code> 值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個元素為通過回呼函式檢驗的新陣列。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>filter()</code> 會將所有陣列中的元素分別傳入一次至 <code>callback</code> 函式當中,並將所有傳入此回呼函式並得到回傳值為 <a href="/zh-TW/docs/Glossary/Truthy">Truthy</a> 的元素建構成一個新的陣列。<code>callback</code> 函式只會於陣列目前迭代之索引有指派值時被呼叫,回呼函式不會在該陣列索引已被刪除或從未被賦值時被調用。原始陣列中沒有通過 <code>callback</code> 檢驗的元素會被簡單的跳過,且不會被包含在新建立的陣列中。</p>
+
+<p><code>callback</code> 函式於被調用時會傳入三個參數:</p>
+
+<ol>
+ <li>元素值</li>
+ <li>元素之索引</li>
+ <li>被迭代的陣列物件</li>
+</ol>
+
+<p>若有提供 <code>thisArg</code> 參數予 <code>filter</code> 方法,<code>thisArg</code> 將會被當作回呼函式的 <code>this</code> 值,否則 <code>this</code> 會是 <code>undefined</code>。<code>callback</code> 的最終 <code>this</code> 值是依據<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/this">函式的 <code>this</code> 規則</a>來決定。</p>
+
+<p><code>filter()</code> 不會修改呼叫它的原始陣列。</p>
+
+<p>由 <code>filter()</code> 方法所回傳之新陣列的範圍,於 <code>callback</code> 函式第一次被調用之前就已經被設定。而在呼叫 <code>filter()</code> 之後才加至原始陣列中的元素,將不會傳入 <code>callback</code> 當中。假如原始陣列中元素的值改變或被刪除了,則 <code>callback</code> 得到此元素的值將會是 <code>filter()</code> 傳入元素當下的值。而被刪除的原始陣列元素並不會被迭代到。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="過濾所有的小數字">過濾所有的小數字</h3>
+
+<p>以下範例會用 <code>filter()</code> 建立一個把所有小於 10 的元素都移掉的陣列。</p>
+
+<pre class="brush: js">function isBigEnough(value) {
+ return value &gt;= 10;
+}
+
+var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
+// filtered is [12, 130, 44]
+</pre>
+
+<h3 id="從_JSON_過濾無效的項目">從 JSON 過濾無效的項目</h3>
+
+<p>以下範例會用 <code>filter()</code> 建立一個把非零 numeric <code>id</code> 的元素都過濾掉的的 JSON。</p>
+
+<pre class="brush: js">var arr = [
+ { id: 15 },
+ { id: -1 },
+ { id: 0 },
+ { id: 3 },
+ { id: 12.2 },
+ { },
+ { id: null },
+ { id: NaN },
+ { id: 'undefined' }
+];
+
+var invalidEntries = 0;
+
+function isNumber(obj) {
+ return obj!== undefined &amp;&amp; typeof(obj) === 'number' &amp;&amp; !isNaN(obj);
+}
+
+function filterByID(item) {
+ if (isNumber(item.id)) {
+ return true;
+ }
+ invalidEntries++;
+ return false;
+}
+
+var arrByID = arr.filter(filterByID);
+
+<code>console.log('過濾好的陣列\n', arrByID);
+// 過濾好的陣列
+// [{ id: 15 }, { id: -1 }, { id: 0 }, { id: 3 }, { id: 12.2 }]
+
+console.log('無效的元素數量 = ', invalidEntries);
+// 無效的元素數量 = 4</code></pre>
+
+<h3 id="在陣列中搜尋">在陣列中搜尋</h3>
+
+<p>下面範例使用 <code>filter()</code> 去過濾符合搜尋條件的陣列內容。</p>
+
+<pre class="brush: js">var fruits = ['apple', 'banana', 'grapes', 'mango', 'orange'];
+
+/**
+ * 陣列透過搜尋條件(查詢)過濾物件
+ */
+function filterItems(query) {
+ return fruits.filter(function(el) {
+ return el.toLowerCase().indexOf(query.toLowerCase()) &gt; -1;
+ })
+}
+
+console.log(filterItems('ap')); // ['apple', 'grapes']
+console.log(filterItems('an')); // ['banana', 'mango', 'orange']</pre>
+
+<h3 id="ES2015_實作方式">ES2015 實作方式</h3>
+
+<pre class="brush: js">const fruits = ['apple', 'banana', 'grapes', 'mango', 'orange'];
+
+/**
+ * 陣列透過搜尋條件(查詢)過濾物件
+ */
+const filterItems = (query) =&gt; {
+ return fruits.filter((el) =&gt;
+ el.toLowerCase().indexOf(query.toLowerCase()) &gt; -1
+ );
+}
+
+console.log(filterItems('ap')); // ['apple', 'grapes']
+console.log(filterItems('an')); // ['banana', 'mango', 'orange']
+
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>filter()</code> 在 ECMA-262 第五版時被納入標準;它也許不會出現在該標準的所有實作引擎之中。你可以在你的腳本最前面加入下面的程式碼作為替代方案,讓不支援 <code>filter()</code> 的 ECMA-262 實作引擎能夠使用它。假設 <code>fn.call</code> 是採用 {{jsxref("Function.prototype.bind()")}} 的原始值,這個演算法完全和 ECMA-262 第五版定義的規格相同。</p>
+
+<pre class="brush: js">if (!Array.prototype.filter)
+ Array.prototype.filter = function(func, thisArg) {
+ 'use strict';
+ if ( ! ((typeof func === 'Function') &amp;&amp; this) )
+ throw new TypeError();
+
+ var len = this.length &gt;&gt;&gt; 0,
+ res = new Array(len), // 預先配置陣列
+ c = 0, i = -1;
+ if (thisArg === undefined)
+ while (++i !== len)
+ // 確認物件的鍵值i是否有被設置
+ if (i in this)
+ if (func(t[i], i, t))
+ res[c++] = t[i];
+ else
+ while (++i !== len)
+ // 確認物件的鍵值i是否有被設置
+ if (i in this)
+ if (func.call(thisArg, t[i], i, t))
+ res[c++] = t[i];
+
+ res.length = c; // 將陣列縮至適當大小
+ return res;
+ };
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.20', 'Array.prototype.filter')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.filter', 'Array.prototype.filter')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.filter', 'Array.prototype.filter')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.filter")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li>{{jsxref("Array.prototype.reduce()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/find/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/find/index.html
new file mode 100644
index 0000000000..0db7e05a3c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/find/index.html
@@ -0,0 +1,204 @@
+---
+title: Array.prototype.find()
+slug: Web/JavaScript/Reference/Global_Objects/Array/find
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/find
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>find()</strong></code> 方法會回傳第一個滿足所提供之測試函式的元素<strong>值</strong>。否則回傳 {{jsxref("undefined")}}。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-find.html")}}</div>
+
+
+
+<p>也可以參考 {{jsxref("Array.findIndex", "findIndex()")}} 方法,它回傳被找到的元素在陣列中的<strong>索引</strong>,而不是它的值。</p>
+
+<p>If you need to find the position of an element or whether an element exists in an array, use {{jsxref("Array.prototype.indexOf()")}} or {{jsxref("Array.prototype.includes()")}}.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.find(<var>callback</var>[, <var>thisArg</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>會處理陣列中每個元素的函數,它使用三個參數:
+ <dl>
+ <dt><code>element</code></dt>
+ <dd>在陣列中正被處理的元素。</dd>
+ <dt><code>index</code>{{optional_inline}}</dt>
+ <dd>在陣列中正被處理的元素的索引。</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>find</code> 的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code> <code>{{Optional_inline}}</code></dt>
+ <dd>執行 <code>callback</code> 函式時被當作 <code>this</code> 的物件。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>若元素通過測試則為其值;否則為 {{jsxref("undefined")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>find</code> 方法會對每個元素執行一次 <code>callback</code> 函式,直到找到一個讓 <code>callback</code> 函式回傳 true 的元素。當元素被找到的時候,<code>find</code> 會立刻回傳該元素,否則 <code>find</code> 會回傳 {{jsxref("undefined")}}。<code>callback</code> 會被使用於陣列索引自 <code>0</code> 至 <code>length - 1</code>,並會被用於每一個的陣列索引,而不僅是那些有賦值的索引。這代表此方法在稀疏陣列(sparse arrays)上的效能可能較其他只存取已賦值索引的方法來的差。</p>
+
+<p><code>callback</code> 函式被呼叫時會傳入三個參數:元素的值、元素索引,以及正被迭代的陣列物件。</p>
+
+<p>如果提供 <code>thisArg</code> 參數予 <code>find</code>,其將會被當作 <code>callback</code> 每次被呼叫的 <code>this</code>。若是沒提供,則會使用 {{jsxref("undefined")}}。</p>
+
+<p><code>find</code> 並不會改變呼叫該方法的陣列。</p>
+
+<p>The range of elements processed by <code>find</code> is set before the first invocation of <code>callback</code>. Elements that are appended to the array after the call to <code>find</code> begins will not be visited by <code>callback</code>. If an existing, unvisited element of the array is changed by <code>callback</code>, its value passed to the visiting <code>callback</code> will be the value at the time that <code>find</code> visits that element's index; elements that are deleted are still visited.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Find_an_object_in_an_array_by_one_of_its_properties">Find an object in an array by one of its properties</h3>
+
+<pre class="brush: js">var inventory = [
+ {name: 'apples', quantity: 2},
+ {name: 'bananas', quantity: 0},
+ {name: 'cherries', quantity: 5}
+];
+
+function isCherries(fruit) {
+ return fruit.name === 'cherries';
+}
+
+console.log(inventory.find(isCherries));
+// { name: 'cherries', quantity: 5 }</pre>
+
+<h3 id="在陣列中找質數">在陣列中找質數</h3>
+
+<p>以下範例在陣列中找出一個屬於質數的元素,如果裡面不含質數則回傳 {{jsxref("undefined")}}。</p>
+
+<pre class="brush: js">function isPrime(element, index, array) {
+ var start = 2;
+ while (start &lt;= Math.sqrt(element)) {
+ if (element % start++ &lt; 1) {
+ return false;
+ }
+ }
+ return element &gt; 1;
+}
+
+console.log([4, 6, 8, 12].find(isPrime)); // undefined, not found
+console.log([4, 5, 8, 12].find(isPrime)); // 5
+</pre>
+
+<p>The following examples show that non-existent and deleted elements are visited and that the value passed to the callback is their value when visited.</p>
+
+<pre class="brush: js">// Declare array with no element at index 2, 3 and 4
+var a = [0,1,,,,5,6];
+
+// Shows all indexes, not just those that have been assigned values
+a.find(function(value, index) {
+ console.log('Visited index ' + index + ' with value ' + value);
+});
+
+// Shows all indexes, including deleted
+a.find(function(value, index) {
+
+ // Delete element 5 on first iteration
+ if (index == 0) {
+ console.log('Deleting a[5] with value ' + a[5]);
+ delete a[5];
+ }
+ // Element 5 is still visited even though deleted
+ console.log('Visited index ' + index + ' with value ' + value);
+});
+
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>這個方法在 ECMAScript 2015 中首次被規範,可能尚未在所有 JavaScript 應用中被實作。你可以使用以下程式片段來 polyfill <code>Array.prototype.find</code>:</p>
+
+<pre class="brush: js">// https://tc39.github.io/ecma262/#sec-array.prototype.find
+if (!Array.prototype.find) {
+ Object.defineProperty(Array.prototype, 'find', {
+ value: function(predicate) {
+ // 1. Let O be ? ToObject(this value).
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+
+ var o = Object(this);
+
+ // 2. Let len be ? ToLength(? Get(O, "length")).
+ var len = o.length &gt;&gt;&gt; 0;
+
+ // 3. If IsCallable(predicate) is false, throw a TypeError exception.
+ if (typeof predicate !== 'function') {
+ throw new TypeError('predicate must be a function');
+ }
+
+ // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ var thisArg = arguments[1];
+
+ // 5. Let k be 0.
+ var k = 0;
+
+ // 6. Repeat, while k &lt; len
+ while (k &lt; len) {
+ // a. Let Pk be ! ToString(k).
+ // b. Let kValue be ? Get(O, Pk).
+ // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ // d. If testResult is true, return kValue.
+ var kValue = o[k];
+ if (predicate.call(thisArg, kValue, k, o)) {
+ return kValue;
+ }
+ // e. Increase k by 1.
+ k++;
+ }
+
+ // 7. Return undefined.
+ return undefined;
+ }
+ });
+}
+</pre>
+
+<p>If you need to support truly obsolete JavaScript engines that don't support <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty</a></code>, it's best not to polyfill <code>Array.prototype</code> methods at all, as you can't make them non-enumerable.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.find', 'Array.prototype.find')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>首次定義</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.find', 'Array.prototype.find')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.find")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.findIndex()")}} – find and return an index</li>
+ <li>{{jsxref("Array.prototype.includes()")}} – test whether a value exists in the array</li>
+ <li>{{jsxref("Array.prototype.filter()")}} – find all matching elements</li>
+ <li>{{jsxref("Array.prototype.every()")}} – test all elements together</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/findindex/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/findindex/index.html
new file mode 100644
index 0000000000..4271ae9ef1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/findindex/index.html
@@ -0,0 +1,181 @@
+---
+title: Array.prototype.findIndex()
+slug: Web/JavaScript/Reference/Global_Objects/Array/findIndex
+tags:
+ - Array
+ - ECMAScript 2015
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/findIndex
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>findIndex()</strong></code> 方法將依據提供的測試函式,尋找陣列中符合的元素,並返回其 <strong>index</strong>(索引)。如果沒有符合的對象,將返回 -1 。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-findindex.html")}}</div>
+
+
+
+<div> </div>
+
+<p>另請參見 {{jsxref("Array.find", "find()")}} 方法,它返回陣列中找到的元素的<strong>值</strong>,而不是其索引。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.findIndex(<var>callback</var>[, <var>thisArg</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>針對陣列中的每個元素,都會執行該回呼函式,執行時會自動傳入下面三個參數:
+ <dl>
+ <dt><code>element</code></dt>
+ <dd>當前元素。</dd>
+ <dt><code>index</code>{{optional_inline}}</dt>
+ <dd>當前元素的索引。</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>findIndex</code> 的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code>{{optional_inline}}</dt>
+ <dd>可選的。執行 <strong>callback</strong> 時作為 this 對象的值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>An index in the array if an element passes the test; otherwise, <strong>-1</strong>.</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>findIndex</code> 方法對陣列中的每一個索引:<code>0..length-1</code>(含)的元素執行一次 <code>callback</code> 直到有一個 <code>callback</code> 返回 truthy 值(一個可強制轉型(coerces)為 <code>true</code> 的值)。如果找到了一個這樣的元素,則 <code>findIndex</code> 將會立刻返回此次迭代的索引。若回呼函式從未回傳一個 truthy 值,或陣列的 <code>length</code> 為 0,則 <code>findIndex</code> 將會返回 -1。不像其他的陣列方法如 <code>some</code> 那樣,於稀疏(sparse)陣列上 <code>callback</code> <strong>仍會</strong>被呼叫,即使該索引的項目在陣列中並不存在。</p>
+
+<p><code>callback</code> 被呼叫時會傳入三個參數:元素的值、元素的索引,以及被迭代的陣列物件。</p>
+
+<p>如果一個 <code>thisArg</code> 參數被提供給 <code>findIndex</code>,它將會被當作 <code>this</code> 使用在每次回呼函式被調用的時候。如果沒有被提供,將會使用 {{jsxref("undefined")}}。</p>
+
+<p><code>findIndex</code> 不會修改呼叫此方法的陣列。</p>
+
+<p>在第一次呼叫 <code>callback</code> 函式時會確定元素的索引範圍,因此在 <code>findIndex</code> 方法開始執行之後添加到陣列的新元素將不會被 <code>callback</code> 函式訪問到。如果陣列中一個尚未被 <code>callback</code> 函式訪問到的元素的值被 <code>callback</code> 函式所改變,那麼當 <code>callback</code> 函式訪問到它時,它的值是將是根據它在陣列中的索引所訪問到的當前值;被刪除的元素仍然會被訪問到。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="尋找陣列中首個質數元素的索引">尋找陣列中首個質數元素的索引</h3>
+
+<p>以下的範例演示了如何查找一個陣列中首個質數元素的索引,找不到則返回 -1。</p>
+
+<pre class="brush: js">function isPrime(element, index, array) {
+ var start = 2;
+ while (start &lt;= Math.sqrt(element)) {
+ if (element % start++ &lt; 1) {
+ return false;
+ }
+ }
+ return element &gt; 1;
+}
+
+console.log([4, 6, 8, 12].findIndex(isPrime)); // -1, not found
+console.log([4, 6, 7, 12].findIndex(isPrime)); // 2
+</pre>
+
+<h3 id="使用箭頭函式尋找索引">使用箭頭函式尋找索引</h3>
+
+<p>以下範例為使用箭頭函式尋找水果的索引。</p>
+
+<pre class="brush: js">const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"];
+
+const index = fruits.findIndex(fruit =&gt; fruit === "blueberries");
+
+console.log(index); // 3
+console.log(fruits[index]); // blueberries
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
+if (!Array.prototype.findIndex) {
+ Object.defineProperty(Array.prototype, 'findIndex', {
+ value: function(predicate) {
+ // 1. Let O be ? ToObject(this value).
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+
+ var o = Object(this);
+
+ // 2. Let len be ? ToLength(? Get(O, "length")).
+ var len = o.length &gt;&gt;&gt; 0;
+
+ // 3. If IsCallable(predicate) is false, throw a TypeError exception.
+ if (typeof predicate !== 'function') {
+ throw new TypeError('predicate must be a function');
+ }
+
+ // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ var thisArg = arguments[1];
+
+ // 5. Let k be 0.
+ var k = 0;
+
+ // 6. Repeat, while k &lt; len
+ while (k &lt; len) {
+ // a. Let Pk be ! ToString(k).
+ // b. Let kValue be ? Get(O, Pk).
+ // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
+ // d. If testResult is true, return k.
+ var kValue = o[k];
+ if (predicate.call(thisArg, kValue, k, o)) {
+ return k;
+ }
+ // e. Increase k by 1.
+ k++;
+ }
+
+ // 7. Return -1.
+ return -1;
+ }
+ });
+}
+</pre>
+
+<p>如果您需要相容過時的不支援 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty</a></code> 的 JavaScript 引擎,最好不要使用 polyfill 來填充 <code>Array.prototype</code> 方法,因為無法使它們成為不可枚舉的(non-enumerable)屬性。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.findindex', 'Array.prototype.findIndex')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.findIndex', 'Array.prototype.findIndex')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.findIndex")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.find()")}}</li>
+ <li>{{jsxref("Array.prototype.indexOf()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/flat/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/flat/index.html
new file mode 100644
index 0000000000..8a6a4b2549
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/flat/index.html
@@ -0,0 +1,148 @@
+---
+title: Array.prototype.flat()
+slug: Web/JavaScript/Reference/Global_Objects/Array/flat
+tags:
+ - JavaScript
+ - 實驗中
+ - 方法
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/flat
+---
+<div>{{JSRef}} {{SeeCompatTable}}</div>
+
+<p><code><strong>flat()</strong></code> 函數以遞迴方式將特定深度的子陣列重新串接成為一新的陣列</p>
+
+<p class="hidden">\{{EmbedInteractiveExample("pages/js/array-flatten.html")}}</p>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>var newArray = arr</var>.flat(<em>[depth]</em>);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>depth</code> {{optional_inline}}</dt>
+ <dd>指定巢狀陣列展開的深度。預設為1。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>函數將會回傳一個由原先陣列的子陣列串接而成的新陣列。</p>
+
+
+
+<h2 id="範例">範例</h2>
+
+<h3 id="展開巢狀陣列">展開巢狀陣列</h3>
+
+<pre class="brush: js">var arr1 = [1, 2, [3, 4]];
+arr1.flat();
+// [1, 2, 3, 4]
+
+var arr2 = [1, 2, [3, 4, [5, 6]]];
+arr2.flat();
+// [1, 2, 3, 4, [5, 6]]
+
+var arr3 = [1, 2, [3, 4, [5, 6]]];
+arr3.flat(2);
+// [1, 2, 3, 4, 5, 6]</pre>
+
+<h3 id="當遭遇空元素時">當遭遇空元素時</h3>
+
+<p>flat()函數會自動清除陣列中空的元素</p>
+
+<pre class="brush: js">var arr4 = [1, 2, , 4, 5];
+arr4.flat();
+// [1, 2, 4, 5]
+</pre>
+
+<h2 id="替代方案">替代方案</h2>
+
+<h3 id="reduce_與_concat"><code>reduce</code> 與 <code>concat</code></h3>
+
+<pre class="brush: js">var arr1 = [1, 2, [3, 4]];
+arr1.flat();
+
+//展開單層陣列
+arr1.reduce((acc, val) =&gt; acc.concat(val), []);// [1, 2, 3, 4]
+</pre>
+
+
+
+<pre class="brush: js">//欲展開更深層的巢狀結構請使用reduce與concat的遞迴
+function flattenDeep(arr1) {
+ return arr1.reduce((acc, val) =&gt; Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val), []);
+}
+flattenDeep(arr1);// [1, 2, 3, 1, 2, 3, 4, 2, 3, 4]
+</pre>
+
+
+
+<pre class="brush: js">//使用stack來實作非遞迴的展開
+var arr1 = [1,2,3,[1,2,3,4, [2,3,4]]];
+function flatten(input) {
+ const stack = [...input];
+ const res = [];
+ while (stack.length) {
+ // pop value from stack
+ const next = stack.pop();
+ if (Array.isArray(next)) {
+ // push back array items, won't modify the original input
+ stack.push(...next);
+ } else {
+ res.push(next);
+ }
+ }
+ //reverse to restore input order
+ return res.reverse();
+}
+flatten(arr1);// [1, 2, 3, 1, 2, 3, 4, 2, 3, 4]
+</pre>
+
+<pre><code>// 递归版本的反嵌套
+function flatten(array) {
+ var flattend = [];
+ (function flat(array) {
+ array.forEach(function(el) {
+ if (Array.isArray(el)) flat(el);
+ else flattend.push(el);
+ });
+ })(array);
+ return flattend;
+}</code></pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td><a href="https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flat"><code>Array.prototype.flat</code> proposal</a></td>
+ <td>Candidate (3)</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.flat")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.flatMap()")}}</li>
+ <li>{{jsxref("Array.prototype.map()")}}</li>
+ <li>{{jsxref("Array.prototype.reduce()")}}</li>
+ <li>{{jsxref("Array.prototype.concat()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html
new file mode 100644
index 0000000000..df1dc91684
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/foreach/index.html
@@ -0,0 +1,297 @@
+---
+title: Array.prototype.forEach()
+slug: Web/JavaScript/Reference/Global_Objects/Array/forEach
+tags:
+ - Array
+ - ECMAScript 5
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/forEach
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>forEach()</strong></code> 方法會將陣列內的每個元素,皆傳入並執行給定的函式一次。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-foreach.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.forEach(function <var>callback(currentValue[, index[, array]]) {
+ //your iterator
+}</var>[, <var>thisArg</var>]);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>這個 callback 函式將會把 Array 中的每一個元素作為參數,帶進本 callback 函式裡,每個元素各執行一次,接收三個參數:
+ <dl>
+ <dt><code>currentValue</code></dt>
+ <dd>代表目前被處理中的 Array 之中的那個元素。</dd>
+ <dt><code>index</code>{{optional_inline}}</dt>
+ <dd>代表目前被處理中的 Array 之中的那個元素的index.</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>forEach()</code> 方法的那個 Array 本身,也就是上面語法中的 arr。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code> {{Optional_inline}}</dt>
+ <dd>執行 <code>callback</code> 回呼函式的 <code><strong>this</strong></code>(即參考之 <code>Object</code>)值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>{{jsxref("undefined")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>forEach()</code> executes the provided <code>callback</code> once for each element present in the array in ascending order. It is not invoked for index properties that have been deleted or are uninitialized (i.e. on sparse arrays).</p>
+
+<p><code>callback</code> is invoked with <strong>three arguments</strong>:</p>
+
+<ul>
+ <li>the <strong>element value</strong></li>
+ <li>the <strong>element index</strong></li>
+ <li>the <strong>array being traversed</strong></li>
+</ul>
+
+<p>If a <code>thisArg</code> parameter is provided to <code>forEach()</code>, it will be used as callback's <code>this</code> value.  Otherwise, the value {{jsxref("undefined")}} will be used as its <code>this</code> value. The <code>this</code> value ultimately observable by <code>callback</code> is determined according to <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/this">the usual rules for determining the <code>this</code> seen by a function</a>.</p>
+
+<p>The range of elements processed by <code>forEach()</code> is set before the first invocation of <code>callback</code>. Elements that are appended to the array after the call to <code>forEach()</code> begins will not be visited by <code>callback</code>. If the values of existing elements of the array are changed, the value passed to <code>callback</code> will be the value at the time <code>forEach()</code> visits them; elements that are deleted before being visited are not visited. If elements that are already visited are removed (e.g. using {{jsxref("Array.prototype.shift()", "shift()")}}) during the iteration, later elements will be skipped - see example below.</p>
+
+<p><code>forEach()</code> executes the <code>callback</code> function once for each array element; unlike {{jsxref("Array.prototype.map()", "map()")}} or {{jsxref("Array.prototype.reduce()", "reduce()")}} it always returns the value {{jsxref("undefined")}} and is not chainable. The typical use case is to execute side effects at the end of a chain.</p>
+
+<p><code>forEach()</code> does not mutate the array on which it is called (although <code>callback</code>, if invoked, may do so).</p>
+
+<div class="note">
+<p>除非是拋出異常,否則並沒有中止 <code>forEach()</code> 迴圈的辦法。如果你需要這樣做,<code>forEach()</code> 就是錯誤的用法,相反的,應該要用簡單的迴圈。如果你要測試陣列裡面的元素並回傳布林值,可以用 {{jsxref("Array.prototype.every()", "every()")}} 或 {{jsxref("Array.prototype.some()", "some()")}}。如果可以的話,新的方法 {{jsxref("Array.prototype.find()", "find()")}} 或 {{jsxref("Array.prototype.findIndex()", "findIndex()")}} 也可以用於 true 值之後提前終止。</p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Converting_from_for_to_forEach">Converting from for to forEach</h3>
+
+<p>before</p>
+
+<pre class="brush:js">const items = ['item1', 'item2', 'item3'];
+const copy = [];
+
+for (let i=0; i&lt;items.length; i++) {
+ copy.push(items[i])
+}
+</pre>
+
+<p>after</p>
+
+<pre class="brush:js">const items = ['item1', 'item2', 'item3'];
+const copy = [];
+
+items.forEach(function(item){
+ copy.push(item)
+});
+
+</pre>
+
+<p> </p>
+
+<h3 id="Printing_the_contents_of_an_array">Printing the contents of an array</h3>
+
+<p>The following code logs a line for each element in an array:</p>
+
+<pre class="brush:js">function logArrayElements(element, index, array) {
+ console.log('a[' + index + '] = ' + element);
+}
+
+// Notice that index 2 is skipped since there is no item at
+// that position in the array.
+[2, 5, , 9].forEach(logArrayElements);
+// logs:
+// a[0] = 2
+// a[1] = 5
+// a[3] = 9
+</pre>
+
+<h3 id="Using_thisArg">Using <code>thisArg</code></h3>
+
+<p>The following (contrived) example updates an object's properties from each entry in the array:</p>
+
+<pre class="brush:js">function Counter() {
+ this.sum = 0;
+ this.count = 0;
+}
+Counter.prototype.add = function(array) {
+ array.forEach(function(entry) {
+ this.sum += entry;
+ ++this.count;
+ }, this);
+ // ^---- Note
+};
+
+const obj = new Counter();
+obj.add([2, 5, 9]);
+obj.count;
+// 3
+obj.sum;
+// 16
+</pre>
+
+<p>Since the <code>thisArg</code> parameter (<code>this</code>) is provided to <code>forEach()</code>, it is passed to <code>callback</code> each time it's invoked, for use as its <code>this</code> value.</p>
+
+<div class="note">
+<p>If passing the function argument using an <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function expression</a> the <code>thisArg</code> parameter can be omitted as arrow functions lexically bind the {{jsxref("Operators/this", "this")}} value.</p>
+</div>
+
+<h3 id="An_object_copy_function">An object copy function</h3>
+
+<p>The following code creates a copy of a given object. There are different ways to create a copy of an object; the following is just one way and is presented to explain how <code>Array.prototype.forEach()</code> works by using ECMAScript 5 <code>Object.*</code> meta property functions.</p>
+
+<pre class="brush: js">function copy(obj) {
+ const copy = Object.create(Object.getPrototypeOf(obj));
+ const propNames = Object.getOwnPropertyNames(obj);
+
+ propNames.forEach(function(name) {
+ const desc = Object.getOwnPropertyDescriptor(obj, name);
+ Object.defineProperty(copy, name, desc);
+ });
+
+ return copy;
+}
+
+const obj1 = { a: 1, b: 2 };
+const obj2 = copy(obj1); // obj2 looks like obj1 now
+</pre>
+
+<h3 id="If_the_array_is_modified_during_iteration_other_elements_might_be_skipped.">If the array is modified during iteration, other elements might be skipped.</h3>
+
+<p>The following example logs "one", "two", "four". When the entry containing the value "two" is reached, the first entry of the whole array is shifted off, which results in all remaining entries moving up one position. Because element "four" is now at an earlier position in the array, "three" will be skipped. <code>forEach()</code> does not make a copy of the array before iterating.</p>
+
+<pre class="brush:js">var words = ['one', 'two', 'three', 'four'];
+words.forEach(function(word) {
+ console.log(word);
+ if (word === 'two') {
+ words.shift();
+ }
+});
+// one
+// two
+// four
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>forEach()</code> was added to the ECMA-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of <code>forEach()</code> in implementations that don't natively support it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming {{jsxref("Object")}} and {{jsxref("TypeError")}} have their original values and that <code>callback.call()</code> evaluates to the original value of {{jsxref("Function.prototype.call()")}}.</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.18
+// Reference: http://es5.github.io/#x15.4.4.18
+if (!Array.prototype.forEach) {
+
+ Array.prototype.forEach = function(callback/*, thisArg*/) {
+
+ var T, k;
+
+ if (this == null) {
+ throw new TypeError('this is null or not defined');
+ }
+
+ // 1. Let O be the result of calling toObject() passing the
+ // |this| value as the argument.
+ var O = Object(this);
+
+ // 2. Let lenValue be the result of calling the Get() internal
+ // method of O with the argument "length".
+ // 3. Let len be toUint32(lenValue).
+ var len = O.length &gt;&gt;&gt; 0;
+
+ // 4. If isCallable(callback) is false, throw a TypeError exception.
+ // See: http://es5.github.com/#x9.11
+ if (typeof callback !== 'function') {
+ throw new TypeError(callback + ' is not a function');
+ }
+
+ // 5. If thisArg was supplied, let T be thisArg; else let
+ // T be undefined.
+ if (arguments.length &gt; 1) {
+ T = arguments[1];
+ }
+
+ // 6. Let k be 0.
+ k = 0;
+
+ // 7. Repeat while k &lt; len.
+ while (k &lt; len) {
+
+ var kValue;
+
+ // a. Let Pk be ToString(k).
+ // This is implicit for LHS operands of the in operator.
+ // b. Let kPresent be the result of calling the HasProperty
+ // internal method of O with argument Pk.
+ // This step can be combined with c.
+ // c. If kPresent is true, then
+ if (k in O) {
+
+ // i. Let kValue be the result of calling the Get internal
+ // method of O with argument Pk.
+ kValue = O[k];
+
+ // ii. Call the Call internal method of callback with T as
+ // the this value and argument list containing kValue, k, and O.
+ callback.call(T, kValue, k, O);
+ }
+ // d. Increase k by 1.
+ k++;
+ }
+ // 8. return undefined.
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.18', 'Array.prototype.forEach')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.foreach', 'Array.prototype.forEach')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.foreach', 'Array.prototype.forEach')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.forEach")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.find()")}}</li>
+ <li>{{jsxref("Array.prototype.findIndex()")}}</li>
+ <li>{{jsxref("Array.prototype.map()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+ <li>{{jsxref("Map.prototype.forEach()")}}</li>
+ <li>{{jsxref("Set.prototype.forEach()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/from/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/from/index.html
new file mode 100644
index 0000000000..229b92f5e6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/from/index.html
@@ -0,0 +1,215 @@
+---
+title: Array.from()
+slug: Web/JavaScript/Reference/Global_Objects/Array/from
+tags:
+ - Array
+ - ECMAScript 2015
+ - JavaScript
+ - Method
+ - Reference
+ - polyfill
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/from
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Array.from()</strong></code> 方法會從類陣列(array-like)或是可迭代(iterable)物件建立一個新的 <code>Array</code> 實體。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-from.html")}}</div>
+
+
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>arrayLike</code></dt>
+ <dd>將類陣列或可迭代物件轉換成陣列</dd>
+ <dt><code>mapFn {{Optional_inline}}</code></dt>
+ <dd>Map 函式走訪陣列中的每一個元素。</dd>
+ <dt><code>thisArg {{Optional_inline}}</code></dt>
+ <dd><code>mapFn</code> 函式執行時的 <code>this</code> 對象。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 {{jsxref("Array")}} 實體。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Array.from()</code> 讓你從這些物件建立陣列:</p>
+
+<ul>
+ <li>類陣列(array-like)物件(物件具有 <code>length</code> 屬性以及索引化(indexed)的元素)或</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/iterable">可迭代物件</a>(物件具有可以讓你利用迭代的方式取得它自己本身的元素,像是 {{jsxref("Map")}} 和 {{jsxref("Set")}})。</li>
+</ul>
+
+<p><code>Array.from()</code> 有個可選用的參數 <code>mapFn</code>,它允許你在建立出新的陣列實體之後,可以接著對陣列(或是其子類別物件)中的每一個元素執行 {{jsxref("Array.prototype.map", "map")}} 函式。更清楚地說,<code> Array.from(obj, mapFn, thisArg)</code> 跟 <code>Array.from(obj).map(mapFn, thisArg)</code> 的結果是一樣的,除非所建立的不是一個可用的中介陣列(intermediate array)。這對於某些陣列的子類別來說就很重要,例如<a href="/zh-TW/docs/Web/JavaScript/Typed_arrays">型別陣列</a>,因為中介陣列必須要把內容值做一番截頭去尾的操作來讓它們變成適合的物件型態。</p>
+
+<p><code>from()</code> 方法的 <code>length</code> 屬性值為 1。</p>
+
+<p>在 ES2015,類別語法允許原生內建的物件以及使用者自定義的物件可以被子類別化(sub-classing);因此,靜態方法像是 <code>Array.from</code>,是「繼承」了 <code>Array</code> 的子類別後,然後建立新的子類別的實體,而不是建立 <code>Array</code> 本身。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="從字串產生陣列">從字串產生陣列</h3>
+
+<pre class="brush: js">Array.from('foo');
+// ["f", "o", "o"]</pre>
+
+<h3 id="從集合產生陣列">從集合產生陣列</h3>
+
+<pre class="brush: js">var s = new Set(['foo', window]);
+Array.from(s);
+// ["foo", window]</pre>
+
+<h3 id="從映射產生陣列">從映射產生陣列</h3>
+
+<pre class="brush: js">var m = new Map([[1, 2], [2, 4], [4, 8]]);
+Array.from(m);
+// [[1, 2], [2, 4], [4, 8]]</pre>
+
+<h3 id="從類陣列物件(arguments)產生陣列">從類陣列物件(arguments)產生陣列</h3>
+
+<pre class="brush: js">function f() {
+ return Array.from(arguments);
+}
+
+f(1, 2, 3);
+
+// [1, 2, 3]</pre>
+
+<h3 id="使用箭頭函式及_Array.from">使用箭頭函式及 <code>Array.from</code></h3>
+
+<pre class="brush: js">// 使用箭頭函式作為 map 函式來
+// 操作元素
+Array.from([1, 2, 3], x =&gt; x + x);
+// [2, 4, 6]
+
+// 產生數值序列
+// 因為陣列中的每個位置都會被初始化為 `undefined`,
+// 下方 `v` 會是 `undefined`
+Array.from({length: 5}, (v, i) =&gt; i);
+// [0, 1, 2, 3, 4]
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>Array.from</code> 在 ECMA-262 標準第六版(ES2015)被加入;在某些實作可能尚未被支援。你可以將下面的程式碼插入到妳的 script 的最前面,如果你使用的工作環境不具有原生支援 <code>Array.from</code> 的能力。這個演算法根據 ECMA-262 第六版中的規範實現,假定 <code>Object</code> 及 <code>TypeError</code> 它們本身已具有值且 <code>callback.call</code> 對應到原本 {{jsxref("Function.prototype.call")}} 的值。除此之外,因為 Polyfill 無法實現真正的迭代,這個實作不支援 ECMA-262 第六版中所定義的泛型迭代。</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 6, 22.1.2.1
+if (!Array.from) {
+ Array.from = (function () {
+ var toStr = Object.prototype.toString;
+ var isCallable = function (fn) {
+ return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
+ };
+ var toInteger = function (value) {
+      var number = Number(value);
+      if (isNaN(number)) { return 0; }
+      if (number === 0 || !isFinite(number)) { return number; }
+      return (number &gt; 0 ? 1 : -1) * Math.floor(Math.abs(number));
+   };
+ var maxSafeInteger = Math.pow(2, 53) - 1;
+ var toLength = function (value) {
+      var len = toInteger(value);
+ return Math.min(Math.max(len, 0), maxSafeInteger);
+    };
+
+ // The length property of the from method is 1.
+ return function from(arrayLike/*, mapFn, thisArg */) {
+ // 1. Let C be the this value.
+ var C = this;
+
+ // 2. Let items be ToObject(arrayLike).
+ var items = Object(arrayLike);
+
+ // 3. ReturnIfAbrupt(items).
+ if (arrayLike == null) {
+ throw new TypeError('Array.from requires an array-like object - not null or undefined');
+ }
+
+ // 4. If mapfn is undefined, then let mapping be false.
+ var mapFn = arguments.length &gt; 1 ? arguments[1] : void undefined;
+ var T;
+ if (typeof mapFn !== 'undefined') {
+ // 5. else
+ // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
+ if (!isCallable(mapFn)) {
+ throw new TypeError('Array.from: when provided, the second argument must be a function');
+ }
+
+ // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
+     if (arguments.length &gt; 2) {
+ T = arguments[2];
+ }
+ }
+
+ // 10. Let lenValue be Get(items, "length").
+ // 11. Let len be ToLength(lenValue).
+ var len = toLength(items.length);
+
+ // 13. If IsConstructor(C) is true, then
+ // 13. a. Let A be the result of calling the [[Construct]] internal method
+ // of C with an argument list containing the single item len.
+ // 14. a. Else, Let A be ArrayCreate(len).
+ var A = isCallable(C) ? Object(new C(len)) : new Array(len);
+
+ // 16. Let k be 0.
+ var k = 0;
+ // 17. Repeat, while k &lt; len… (also steps a - h)
+ var kValue;
+ while (k &lt; len) {
+ kValue = items[k];
+ if (mapFn) {
+ A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
+ } else {
+ A[k] = kValue;
+ }
+ k += 1;
+ }
+ // 18. Let putStatus be Put(A, "length", len, true).
+ A.length = len;
+ // 20. Return A.
+ return A;
+ };
+ }());
+}
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.from', 'Array.from')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>首次定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.from', 'Array.from')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.from")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("Array.prototype.map()")}}</li>
+ <li>{{jsxref("TypedArray.from()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/includes/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/includes/index.html
new file mode 100644
index 0000000000..6d3d0e0cb2
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/includes/index.html
@@ -0,0 +1,175 @@
+---
+title: Array.prototype.includes()
+slug: Web/JavaScript/Reference/Global_Objects/Array/includes
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/includes
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>includes()</strong></code> 方法會判斷陣列是否包含特定的元素,並以此來回傳 <code>true</code> 或 <code>false</code>。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-includes.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.includes(<var>searchElement[</var>, <var>fromIndex]</var>)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>searchElement</code></dt>
+ <dd>要搜尋的元素。</dd>
+ <dt><code>fromIndex</code> {{optional_inline}}</dt>
+ <dd>要於此陣列中開始搜尋 <code>searchElement</code> 的位置。如為負數值,則自 <code>array.length + fromIndex</code> 開始向後搜尋。預設值為 0。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>布林值({{jsxref("Boolean")}})。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">[1, 2, 3].includes(2); // true
+[1, 2, 3].includes(4); // false
+[1, 2, 3].includes(3, 3); // false
+[1, 2, 3].includes(3, -1); // true
+[1, 2, NaN].includes(NaN); // true
+</pre>
+
+<h3 id="fromIndex_大於或等於陣列長度"><code>fromIndex</code> 大於或等於陣列長度</h3>
+
+<p>如果 <code>fromIndex</code>大於或等於陣列長度, 會回傳<code>false</code>. 此陣列將不會被搜尋.</p>
+
+<pre class="brush: js">var arr = ['a', 'b', 'c'];
+
+arr.includes('c', 3); // false
+arr.includes('c', 100); // false</pre>
+
+<h3 id="Computed_index_is_less_than_0">Computed index is less than 0</h3>
+
+<p>If <code>fromIndex</code> is negative, the computed index is calculated to be used as a position in the array at which to begin searching for <code>searchElement</code>. If the computed index is less than 0, the entire array will be searched.</p>
+
+<pre class="brush: js">// array length is 3
+// fromIndex is -100
+// computed index is 3 + (-100) = -97
+
+var arr = ['a', 'b', 'c'];
+
+arr.includes('a', -100); // true
+arr.includes('b', -100); // true
+arr.includes('c', -100); // true</pre>
+
+<h3 id="includes_used_as_a_generic_method"><code>includes()</code> used as a generic method</h3>
+
+<p><code>includes()</code> method is intentionally generic. It does not require <code>this</code> value to be an Array object, so it can be applied to other kinds of objects (e.g. array-like objects). The example below illustrates <code>includes()</code> method called on the function's <a href="/en-US/docs/Web/JavaScript/Reference/Functions/arguments">arguments</a> object.</p>
+
+<pre class="brush: js">(function() {
+ console.log([].includes.call(arguments, 'a')); // true
+  console.log([].includes.call(arguments, 'd')); // false
+})('a','b','c');</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">// https://tc39.github.io/ecma262/#sec-array.prototype.includes
+if (!Array.prototype.includes) {
+ Object.defineProperty(Array.prototype, 'includes', {
+ value: function(searchElement, fromIndex) {
+
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+
+ // 1. Let O be ? ToObject(this value).
+ var o = Object(this);
+
+ // 2. Let len be ? ToLength(? Get(O, "length")).
+ var len = o.length &gt;&gt;&gt; 0;
+
+ // 3. If len is 0, return false.
+ if (len === 0) {
+ return false;
+ }
+
+ // 4. Let n be ? ToInteger(fromIndex).
+ // (If fromIndex is undefined, this step produces the value 0.)
+ var n = fromIndex | 0;
+
+ // 5. If n ≥ 0, then
+ // a. Let k be n.
+ // 6. Else n &lt; 0,
+ // a. Let k be len + n.
+ // b. If k &lt; 0, let k be 0.
+ var k = Math.max(n &gt;= 0 ? n : len - Math.abs(n), 0);
+
+  function sameValueZero(x, y) {
+ return x === y || (typeof x === 'number' &amp;&amp; typeof y === 'number' &amp;&amp; isNaN(x) &amp;&amp; isNaN(y));
+  }
+
+ // 7. Repeat, while k &lt; len
+ while (k &lt; len) {
+ // a. Let elementK be the result of ? Get(O, ! ToString(k)).
+ // b. If SameValueZero(searchElement, elementK) is true, return true.
+ if (sameValueZero(o[k], searchElement)) {
+ return true;
+ }
+  // c. Increase k by 1.
+ k++;
+ }
+
+ // 8. Return false
+ return false;
+ }
+ });
+}
+</pre>
+
+<p>If you need to support truly obsolete JavaScript engines that don't support <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty</a></code>, it's best not to polyfill <code>Array.prototype</code> methods at all, as you can't make them non-enumerable.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES7', '#sec-array.prototype.includes', 'Array.prototype.includes')}}</td>
+ <td>{{Spec2('ES7')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.includes', 'Array.prototype.includes')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.includes")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("TypedArray.prototype.includes()")}}</li>
+ <li>{{jsxref("String.prototype.includes()")}}</li>
+ <li>{{jsxref("Array.prototype.indexOf()")}}</li>
+ <li>{{jsxref("Array.prototype.find()")}}</li>
+ <li>{{jsxref("Array.prototype.findIndex()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/index.html
new file mode 100644
index 0000000000..fe344c1811
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/index.html
@@ -0,0 +1,457 @@
+---
+title: Array
+slug: Web/JavaScript/Reference/Global_Objects/Array
+tags:
+ - Array
+ - JavaScript
+ - NeedsTranslation
+ - TopicStub
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array
+---
+<div>{{JSRef}}</div>
+
+<p>JavaScript 中的 <strong><code>Array</code></strong> 全域物件被用於建構陣列;陣列為高階(high-level)、似列表(list-like)的物件。陣列在Javascript 裡面並沒有固定的長度與型別。由於陣列的長度可以隨時被改變,所以並不能保證陣列的密度。這取決於開發者如何使用陣列。一般來說,這是個非常方便的特性,但如果這並不適用於你的開發工作,你也許會考慮使用型別陣列。</p>
+
+<p><strong>建立陣列</strong></p>
+
+<pre class="brush: js">var fruits = ['Apple', 'Banana'];
+
+console.log(fruits.length);
+// 2
+</pre>
+
+<p><strong>(透過索引)取得陣列項目</strong></p>
+
+<pre class="brush: js">var first = fruits[0];
+// Apple
+
+var last = fruits[fruits.length - 1];
+// Banana
+</pre>
+
+<p><strong>迭代陣列</strong></p>
+
+<pre class="brush: js">fruits.forEach(function(item, index, array) {
+  console.log(item, index);
+});
+// Apple 0
+// Banana 1
+</pre>
+
+<p><strong>加入項目至陣列末端</strong></p>
+
+<pre class="brush: js">var newLength = fruits.push('Orange');
+// ["Apple", "Banana", "Orange"]
+</pre>
+
+<p><strong>移除陣列末端項目</strong></p>
+
+<pre class="brush: js">var last = fruits.pop(); // 移除 <code>(</code>最末端的<code>) </code>Orange
+// ["Apple", "Banana"];
+</pre>
+
+<p><strong>移除陣列前端項目</strong></p>
+
+<pre class="brush: js"><code>var first = fruits.shift(); // 移除 (最前端的) Apple
+// ["Banana"];</code></pre>
+
+<p><strong>加入項目至陣列前端</strong></p>
+
+<pre class="brush: js">var newLength = fruits.unshift('Strawberry') // 加到陣列前端
+// ["Strawberry", "Banana"];
+</pre>
+
+<p><strong>在陣列中尋找項目的索引</strong></p>
+
+<pre class="brush: js">fruits.push('Mango');
+// ["Strawberry", "Banana", "Mango"]
+
+var pos = fruits.indexOf('Banana');
+// 1
+</pre>
+
+<p><strong>移除指定索引位置的項目</strong></p>
+
+<pre class="brush: js">var removedItem = fruits.splice(pos, 1); // 移除 pos 起的 1 個項目
+
+// ["Strawberry", "Mango"]</pre>
+
+<p><strong>移除指定索引位置起的多個項目</strong></p>
+
+<pre class="brush: js">var vegetables = ['Cabbage', 'Turnip', 'Radish', 'Carrot'];
+console.log(vegetables);
+// ["Cabbage", "Turnip", "Radish", "Carrot"]
+
+var pos = 1, n = 2;
+
+var removedItems = vegetables.splice(pos, n);
+// 這就是移除項目的方式,
+// n 表示從該位置 (pos) 開始,一直到陣列的尾端有多少項目需要移除
+
+console.log(vegetables);
+// ["Cabbage", "Carrot"] (原始的陣列被改變)
+
+console.log(removedItems);
+// ["Turnip", "Radish"]</pre>
+
+<p><strong>複製陣列</strong></p>
+
+<pre class="brush: js">var shallowCopy = fruits.slice(); // 這就是複製陣列的方式
+// ["Strawberry", "<code>Mango</code>"]
+</pre>
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<pre class="syntaxbox">[<var>element0</var>, <var>element1</var>, ..., <var>elementN</var>]
+new Array(<var>element0</var>, <var>element1</var>[, ...[, <var>elementN</var>]])
+new Array(<var>arrayLength</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>element<em>N</em></code></dt>
+ <dd>除了只傳遞一個參數給 <code>Array</code> 構造函數,且該參數為一個數字的情況(詳見下方的 arrayLength 參數),JavaScript 陣列會以傳入的元素進行初始化。</dd>
+ <dd>請注意,這種特殊情況僅適用於以 <code>Array </code>構造函數建立的 JavaScript 陣列,而不適用於以括號語法建立的陣列常值(Array Literals)。</dd>
+ <dt><code>arrayLength</code></dt>
+ <dd>如果傳遞給 <code>Array</code> 構造函數的唯一參數是 0 和 2<sup>32</sup>-1(含)之間的整數,將回傳一個新的 JavaScript 陣列,其長度被設定為這個數字。如果參數是任何其他數值,將拋出 {{jsxref("RangeError")}} 異常。</dd>
+</dl>
+
+<h2 id="Description" name="Description">說明</h2>
+
+<p>Array(「陣列」)是類似列表(list)的物件(Object),它們的原型(Prototype)擁有方法(methods)來執行遍歷和變異操作。JavaScript 陣列的長度(元素數量),以及其元素的類型都不是固定的。取決於工程師如何選擇使用陣列,可以隨時更改陣列的長度,也可不連續儲存資料, 所以並不保證這些資料是集中的。一般情況下,這些特性很方便使用;但若這些功能都不符合您的用途,您可能會想使用型別陣列(typed arrays)。</p>
+
+<p>有些人認為即便會發生警告,仍然<a class="external" href="http://www.andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/">不應該使用關聯陣列</a>,而應該使用 {{jsxref("Global_Objects/Object", "objects")}}。您可參考<a class="external" href="http://www.less-broken.com/blog/2010/12/lightweight-javascript-dictionaries.html">輕量級 JavaScript 字典</a>當中的範例。</p>
+
+<h3 id="Accessing_array_elements" name="Accessing_array_elements">存取陣列元素</h3>
+
+<p>JavaScript 陣列是 zero-indexed:陣列元素的索引值編排從 0 開始,而最後一個元素的索引值等同於陣列的 {{jsxref("Array.length", "length")}} 屬性減 1。</p>
+
+<pre class="brush: js">var arr = ['this is the first element', 'this is the second element'];
+console.log(arr[0]); // 紀錄出 'this is the first element'
+console.log(arr[1]); // 記錄出 'this is the second element'
+console.log(arr[arr.length - 1]); // 記錄出 'this is the second element'
+</pre>
+
+<p>Array 元素同時也是物件的屬性,與 <code>toString</code> 是一種屬性相同。但若要透過下面這種方式存取陣列元素,因為屬性名稱無效的關係,會發生語法錯誤:</p>
+
+<pre class="brush: js">console.log(arr.0); // 語法錯誤
+</pre>
+
+<p>會造成如此的原因沒有什麼特別的,在 JavaScript 當中無法用小數點的方式來參照一個名稱開頭為數字的屬性,而必須括號的表示方式來存取。舉例來說,若您有個物件的屬性名稱為「<code>3d</code>」,就只能用括號的方式來參照。</p>
+
+<p>請看下列範例:</p>
+
+<pre class="brush: js">var years = [1950, 1960, 1970, 1980, 1990, 2000, 2010];
+console.log(years.0); // 語法錯誤
+console.log(years[0]); // 程式正常
+</pre>
+
+<pre class="brush: js">renderer.3d.setTexture(model, 'character.png'); // 語法錯誤
+renderer['3d'].setTexture(model, 'character.png'); // 程式正常
+</pre>
+
+<p>注意:以這個 <code>'3d'</code> 例子來說,必須用引號將 <code>3d</code> 包起來。您也可以將 JavaScript 陣列的索引用引號包起來(例如使用 <code>years['2']</code> 而不用 <code>years[2]</code>),但這不是必要的。JavaScript 會透過隱含的 <code>toString</code>,將 <code>years[2]</code> 當中的 2 強制轉換為字串。由於這個原因,<code>'2'</code> 與 <code>'02'</code> 會參照到 <code>years</code> 物件中的不同項目,下列程式範例結果可能回傳 <code>true</code>:</p>
+
+<pre class="brush: js">console.log(years['2'] != years['02']);
+</pre>
+
+<p>另一種類似的情況是,物件屬性剛好與保留字(!)相同的情況。這種情況下僅能透過括號表示方式當中的字串常值來存取:</p>
+
+<pre class="brush: js">var promise = {
+ 'var' : 'text',
+ 'array': [1, 2, 3, 4]
+};
+
+console.log(promise['var']);
+</pre>
+
+<h3 id="Relationship_between_length_and_numerical_properties" name="Relationship_between_length_and_numerical_properties"><code>length</code> 與數值屬性的關係</h3>
+
+<p>JavaScript 陣列的 {{jsxref("Array.length", "length")}} 屬性和其數值屬性相關。許多陣列的方法被呼叫時會參考 {{jsxref("Array.length", "length")}} 屬性的值(例如 {{jsxref("Array.join", "join")}}、{{jsxref("Array.slice", "slice")}}、{{jsxref("Array.indexOf", "indexOf")}} 等)。而有另一些方法則會去改變 {{jsxref("Array.length", "length")}} 屬性的值,如 {{jsxref("Array.push", "push")}}、{{jsxref("Array.splice", "splice")}}。</p>
+
+<pre class="brush: js">var fruits = [];
+fruits.push('banana', 'apple', 'peach');
+
+console.log(fruits.length); // 3
+</pre>
+
+<p>如果給陣列設定一個數值屬性,其值為有效但超過當下範圍的陣列 index,JavaScript 引擎會依照此數值更新陣列的 {{jsxref("Array.length", "length")}} 屬性:</p>
+
+<pre class="brush: js">fruits[5] = 'mango';
+console.log(fruits[5]); // 'mango'
+console.log(Object.keys(fruits)); // ['0', '1', '2', '5']
+console.log(fruits.length); // 6
+</pre>
+
+<p>提高 {{jsxref("Array.length", "length")}} 屬性。</p>
+
+<pre class="brush: js">fruits.length = 10;
+console.log(Object.keys(fruits)); // ['0', '1', '2', '5']
+console.log(fruits.length); // 10
+</pre>
+
+<div>
+<p>降低 {{jsxref("Array.length", "length")}} 屬性則會刪除陣列元素。</p>
+
+<pre class="brush: js">fruits.length = 2;
+console.log(Object.keys(fruits)); // ['0', '1']
+console.log(fruits.length); // 2
+</pre>
+
+<p>在 {{jsxref("Array.length")}} 頁面裡有進一步解釋。</p>
+</div>
+
+<h3 id="Creating_an_array_using_the_result_of_a_match" name="Creating_an_array_using_the_result_of_a_match">使用 match 回傳結果來建立陣列</h3>
+
+<p>在字串與正規表示式之間的比對結果會產生一個 javascript 陣列。此陣列內含關於比對資訊的屬性與元素。 這樣的陣列由{{jsxref("RegExp.exec")}}, {{jsxref("String.match")}}, 和 {{jsxref("String.replace")}} 所產生。參考以下範例和表格,會有助於說明這些屬性和元素:</p>
+
+<pre class="brush: js">// 比對一個字元 d,後面接著一或多個 b,再接著一個 d
+// Remember matched b's and the following d
+// 忽略大小寫
+
+var myRe = /d(b+)(d)/i;
+var myArray = myRe.exec('cdbBdbsbz');
+</pre>
+
+<p>這項比對結果的屬性與元素參考如下:</p>
+
+<table class="fullwidth-table">
+ <tbody>
+ <tr>
+ <td class="header">屬性/元素</td>
+ <td class="header">說明</td>
+ <td class="header">範例</td>
+ </tr>
+ <tr>
+ <td><code>input</code></td>
+ <td>唯讀屬性,代表 正規表示式用以比對的原始字串。</td>
+ <td>cdbBdbsbz</td>
+ </tr>
+ <tr>
+ <td><code>index</code></td>
+ <td>唯讀屬性,代表在字串中比對得到的索引,是以零為基礎(從0開始)。</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td><code>[0]</code></td>
+ <td>一個唯獨元素以表示最後符合的字串</td>
+ <td>dbBd</td>
+ </tr>
+ <tr>
+ <td><code>[1], ...[n]</code></td>
+ <td>Read-only elements that specify the parenthesized substring matches, if included in the regular expression. The number of possible parenthesized substrings is unlimited.</td>
+ <td>[1]: bB<br>
+ [2]: d</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Properties" name="Properties">屬性</h2>
+
+<dl>
+ <dt>Array.length</dt>
+ <dd><code>Array</code> 建構子的長度為 1。</dd>
+ <dt>{{jsxref("Array.@@species", "get Array[@@species]")}}</dt>
+ <dd>用來建立衍生物件的建構函數。</dd>
+ <dt>{{jsxref("Array.prototype")}}</dt>
+ <dd>可加入屬性至所有陣列物件。</dd>
+</dl>
+
+<h2 id="Methods" name="Methods">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Array.from()")}}</dt>
+ <dd>用類似陣列或可列舉物件,來建立新的 <code>Array</code> 實例。</dd>
+ <dt>{{jsxref("Array.isArray()")}}</dt>
+ <dd>若變數是陣列就回傳 true,否則回傳 false。</dd>
+ <dt>{{jsxref("Array.of()")}}</dt>
+ <dd>用可變數量的引數來建立新的 <code>Array</code> 實例,不論引數的數量或型別。</dd>
+</dl>
+
+<h2 id="Array_instances" name="Array_instances"><code>Array</code> 實例</h2>
+
+<p>所有的陣列實例都繼承自 {{jsxref("Array.prototype")}}。若修改這個陣列建構子 (Array constructor) 的原型物件 (prototype object),將會影響所有的陣列實體。</p>
+
+<h3 id="Methods_of_array_instances" name="Methods_of_array_instances">屬性</h3>
+
+<div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Properties')}}</div>
+
+<h3 id="Methods_of_array_instances" name="Methods_of_array_instances">方法</h3>
+
+<h4 id="Mutator_methods" name="Mutator_methods">Mutator methods</h4>
+
+<div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Mutator_methods')}}</div>
+
+<h4 id="Accessor_methods" name="Accessor_methods">Accessor methods</h4>
+
+<div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Accessor_methods')}}</div>
+
+<h4 id="Iteration_methods" name="Iteration_methods">Iteration methods</h4>
+
+<div>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype', 'Iteration_methods')}}</div>
+
+<h2 id="Array_泛型方法"><code>Array</code> 泛型方法</h2>
+
+<div class="warning">
+<p><strong>泛型陣列並非標準且已被棄用,將會在不久之後被去除。</strong> </p>
+</div>
+
+<p>有時你想將陣列方法用於字串或其他類陣列物件(像是函數 {{jsxref("Functions/arguments", "arguments", "", 1)}})。藉此操作,你將此字串視為由字元組成的陣列(反之為將其他非陣列視為物件)。如範例,若要確認字串中的每個字元是不是字母,你可能會這樣寫:</p>
+
+<pre class="brush: js">function isLetter(character) {
+ return character &gt;= 'a' &amp;&amp; character &lt;= 'z';
+}
+
+if (Array.prototype.every.call(str, isLetter)) {
+ console.log("The string '" + str + "' contains only letters!");
+}
+</pre>
+
+<p>這種表示法相當浪費,JavaScript 1.6 導入了一個通用方法:</p>
+
+<pre class="brush: js">if (Array.every(str, isLetter)) {
+ console.log("The string '" + str + "' contains only letters!");
+}
+</pre>
+
+<p>{{jsxref("Global_Objects/String", "Generics", "#String_generic_methods", 1)}} 也同樣可用於 {{jsxref("String")}}.</p>
+
+<p>這<strong>並非 </strong>ECMAScript 的標準,且不被非 Gecko 引擎的瀏覽器支援。你應該將你的物件用  {{jsxref("Array.from()")}} 轉為陣列,以標準替代原有的方法;雖然此方法可能不被舊的瀏覽器所支援:</p>
+
+<pre class="brush: js">if (Array.from(str).every(isLetter)) {
+  console.log("The string '" + str + "' contains only letters!");
+}
+</pre>
+
+<h2 id="Examples" name="Examples">範例</h2>
+
+<h3 id="Example_Creating_an_array" name="Example:_Creating_an_array">範例:建立陣列</h3>
+
+<p>以下範例會產生長度為 0 的 <code>msgArray</code> 陣列,然後指派字串值到 <code>msgArray[0]</code> 及 <code>msgArray[99]</code>,使陣列的長度變為 100。</p>
+
+<pre class="brush: js">var msgArray = [];
+msgArray[0] = 'Hello';
+msgArray[99] = 'world';
+
+if (msgArray.length === 100) {
+ console.log('The length is 100.');
+}
+</pre>
+
+<h3 id="Example_Creating_a_two-dimensional_array" name="Example:_Creating_a_two-dimensional_array">建立二維陣列</h3>
+
+<p>以下範例會用字串產生一張西洋棋盤的二維陣列。第一步是將士兵 'p' 從 (6,4) 移動至 (4,4),然後清空原本的位置 (6,4)。</p>
+
+<pre class="brush: js">var board = [
+ ['R','N','B','Q','K','B','N','R'],
+ ['P','P','P','P','P','P','P','P'],
+ [' ',' ',' ',' ',' ',' ',' ',' '],
+ [' ',' ',' ',' ',' ',' ',' ',' '],
+ [' ',' ',' ',' ',' ',' ',' ',' '],
+ [' ',' ',' ',' ',' ',' ',' ',' '],
+ ['p','p','p','p','p','p','p','p'],
+ ['r','n','b','q','k','b','n','r'] ];
+
+console.log(board.join('\n') + '\n\n');
+
+// 將士兵往前移兩步
+board[4][4] = board[6][4];
+board[6][4] = ' ';
+console.log(board.join('\n'));
+</pre>
+
+<p>以下是輸出結果:</p>
+
+<pre class="eval">R,N,B,Q,K,B,N,R
+P,P,P,P,P,P,P,P
+ , , , , , , ,
+ , , , , , , ,
+ , , , , , , ,
+ , , , , , , ,
+p,p,p,p,p,p,p,p
+r,n,b,q,k,b,n,r
+
+R,N,B,Q,K,B,N,R
+P,P,P,P,P,P,P,P
+ , , , , , , ,
+ , , , , , , ,
+ , , , ,p, , ,
+ , , , , , , ,
+p,p,p,p, ,p,p,p
+r,n,b,q,k,b,n,r
+</pre>
+
+<h3 id="使用陣列來以表格顯示多個數值">使用陣列來以表格顯示多個數值</h3>
+
+<pre class="brush: js">values = [];
+for (var x = 0; x &lt; 10; x++){
+ values.push([
+ 2 ** x,
+ 2 * x ** 2
+ ])
+};
+console.table(values)</pre>
+
+<p>結果會是</p>
+
+<pre class="eval">0 1 0
+1 2 2
+2 4 8
+3 8 18
+4 16 32
+5 32 50
+6 64 72
+7 128 98
+8 256 128
+9 512 162</pre>
+
+<p>(第一欄為索引)</p>
+
+<h2 id="Specifications" name="Specifications">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">技術規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初次定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4', 'Array')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>加入新方法:{{jsxref("Array.isArray")}}, {{jsxref("Array.prototype.indexOf", "indexOf")}}, {{jsxref("Array.prototype.lastIndexOf", "lastIndexOf")}}, {{jsxref("Array.prototype.every", "every")}}, {{jsxref("Array.prototype.some", "some")}}, {{jsxref("Array.prototype.forEach", "forEach")}}, {{jsxref("Array.prototype.map", "map")}}, {{jsxref("Array.prototype.filter", "filter")}}, {{jsxref("Array.prototype.reduce", "reduce")}}, {{jsxref("Array.prototype.reduceRight", "reduceRight")}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array-objects', 'Array')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>加入新方法:{{jsxref("Array.from")}}, {{jsxref("Array.of")}}, {{jsxref("Array.prototype.find", "find")}}, {{jsxref("Array.prototype.findIndex", "findIndex")}}, {{jsxref("Array.prototype.fill", "fill")}}, {{jsxref("Array.prototype.copyWithin", "copyWithin")}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES7', '#sec-array-objects', 'Array')}}</td>
+ <td>{{Spec2('ES7')}}</td>
+ <td>加入新方法:{{jsxref("Array.prototype.includes()")}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Array")}}</p>
+
+<h2 id="See_also" name="See_also">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Indexing_object_properties">JavaScript Guide: “Indexing object properties”</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Predefined_Core_Objects#Array_Object">JavaScript Guide: “Predefined Core Objects: <code>Array</code> Object”</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Array_comprehensions">Array comprehensions</a></li>
+ <li><a href="https://github.com/plusdude/array-generics">Polyfill for JavaScript 1.8.5 Array Generics and ECMAScript 5 Array Extras</a></li>
+ <li><a href="/zh-TW/docs/JavaScript_typed_arrays">Typed Arrays</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html
new file mode 100644
index 0000000000..ff6bbdba76
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/indexof/index.html
@@ -0,0 +1,260 @@
+---
+title: Array.prototype.indexOf()
+slug: Web/JavaScript/Reference/Global_Objects/Array/indexOf
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/indexOf
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>indexOf()</strong></code> 方法會回傳給定元素於陣列中第一個被找到之索引,若不存在於陣列中則回傳 -1。</p>
+
+<div class="note">
+<p><strong>備註:</strong>若是調用字串的方法,請參閱 {{jsxref("String.prototype.indexOf()")}}。</p>
+</div>
+
+<div>{{EmbedInteractiveExample("pages/js/array-indexof.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.indexOf(<var>searchElement[</var>, <var>fromIndex]</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>searchElement</code></dt>
+ <dd>欲在陣列中搜尋的元素。</dd>
+ <dt><code>fromIndex</code> {{optional_inline}}</dt>
+ <dd>陣列中搜尋的起始索引。若這個索引值大於或等於陣列長度,會直接回傳 -1,意即不會在陣列中搜尋。如果索引值是一個負數,會從陣列的最後一個往回算,最後一個的索引值為 -1,以此類推。注意:儘管往回算,但依然會從左往右全部搜尋。如果負數索引值在回頭計算之後仍然小於 0,則會從左往右全部搜尋。 這個參數的預設值為 0(即搜尋整個陣列)。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>在陣列中找到的第一個元素索引值;沒找到則為 <strong>-1</strong>。</p>
+
+<h2 id="說明">說明</h2>
+
+<p><code>indexOf()</code> 用<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators">嚴格相等(strict equality,<code>===</code>)</a>的方式比較陣列中的元素與 <code>searchElement</code> 是否相等。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_indexOf()">使用 <code>indexOf()</code></h3>
+
+<p>下面範例使用<code>indexOf()</code>來定位在陣列中的值。</p>
+
+<pre class="brush: js">var array = [2, 9, 9];
+array.indexOf(2); // 0
+array.indexOf(7); // -1
+array.indexOf(9, 2); // 2
+array.indexOf(2, -1); // -1
+array.indexOf(2, -3); // 0
+</pre>
+
+<h3 id="尋找該元素所有出現在陣列中的位置">尋找該元素所有出現在陣列中的位置</h3>
+
+<pre class="brush: js">var indices = [];
+var array = ['a', 'b', 'a', 'c', 'a', 'd'];
+var element = 'a';
+var idx = array.indexOf(element);
+while (idx != -1) {
+ indices.push(idx);
+ idx = array.indexOf(element, idx + 1);
+}
+console.log(indices);
+// [0, 2, 4]
+</pre>
+
+<h3 id="尋找元素是否存在於陣列中,若沒有則加入到陣列裡。">尋找元素是否存在於陣列中,若沒有則加入到陣列裡。</h3>
+
+<pre class="brush: js">function updateVegetablesCollection (veggies, veggie) {
+ if (veggies.indexOf(veggie) === -1) {
+ veggies.push(veggie);
+ console.log('New veggies collection is : ' + veggies);
+ } else if (veggies.indexOf(veggie) &gt; -1) {
+ console.log(veggie + ' already exists in the veggies collection.');
+ }
+}
+
+var veggies = ['potato', 'tomato', 'chillies', 'green-pepper'];
+
+updateVegetablesCollection(veggies, 'spinach');
+// New veggies collection is : potato,tomato,chillies,green-pepper,spinach
+updateVegetablesCollection(veggies, 'spinach');
+// spinach already exists in the veggies collection.
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>indexOf()</code> was added to the ECMA-262 standard in the 5th edition; as such it may not be present in all browsers. You can work around this by utilizing the following code at the beginning of your scripts. This will allow you to use <code>indexOf()</code> when there is still no native support. This algorithm matches the one specified in ECMA-262, 5th edition, assuming {{jsxref("Global_Objects/TypeError", "TypeError")}} and {{jsxref("Math.abs()")}} have their original values.</p>
+
+<p> </p>
+
+<pre class="brush: js">if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function indexOf(member, startFrom) {
+ /*
+ In non-strict mode, if the `this` variable is null or undefined, then it is
+ set to the window object. Otherwise, `this` is automatically converted to an
+ object. In strict mode, if the `this` variable is null or undefined, a
+ `TypeError` is thrown.
+ */
+ if (this == null) {
+ throw new TypeError("Array.prototype.indexOf() - can't convert `" + this + "` to object");
+ }
+
+ var
+ index = isFinite(startFrom) ? Math.floor(startFrom) : 0,
+ that = this instanceof Object ? this : new Object(this),
+ length = isFinite(that.length) ? Math.floor(that.length) : 0;
+
+ if (index &gt;= length) {
+ return -1;
+ }
+
+ if (index &lt; 0) {
+ index = Math.max(length + index, 0);
+ }
+
+ if (member === undefined) {
+ /*
+ Since `member` is undefined, keys that don't exist will have the same
+ value as `member`, and thus do need to be checked.
+ */
+ do {
+ if (index in that &amp;&amp; that[index] === undefined) {
+ return index;
+ }
+ } while (++index &lt; length);
+ } else {
+ do {
+ if (that[index] === member) {
+ return index;
+ }
+ } while (++index &lt; length);
+ }
+
+ return -1;
+ };
+}</pre>
+
+<p> </p>
+
+<p>However, if you are more interested in all the little technical bits defined by the ECMA standard, and are less concerned about performance or conciseness, then you may find this more descriptive polyfill to be more usefull.</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.14
+// Reference: http://es5.github.io/#x15.4.4.14
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function(searchElement, fromIndex) {
+
+ var k;
+
+ // 1. Let o be the result of calling ToObject passing
+ // the this value as the argument.
+ if (this == null) {
+ throw new TypeError('"this" is null or not defined');
+ }
+
+ var o = Object(this);
+
+ // 2. Let lenValue be the result of calling the Get
+ // internal method of o with the argument "length".
+ // 3. Let len be ToUint32(lenValue).
+ var len = o.length &gt;&gt;&gt; 0;
+
+ // 4. If len is 0, return -1.
+ if (len === 0) {
+ return -1;
+ }
+
+ // 5. If argument fromIndex was passed let n be
+ // ToInteger(fromIndex); else let n be 0.
+ var n = fromIndex | 0;
+
+ // 6. If n &gt;= len, return -1.
+ if (n &gt;= len) {
+ return -1;
+ }
+
+ // 7. If n &gt;= 0, then Let k be n.
+ // 8. Else, n&lt;0, Let k be len - abs(n).
+ // If k is less than 0, then let k be 0.
+ k = Math.max(n &gt;= 0 ? n : len - Math.abs(n), 0);
+
+ // 9. Repeat, while k &lt; len
+ while (k &lt; len) {
+ // a. Let Pk be ToString(k).
+ // This is implicit for LHS operands of the in operator
+ // b. Let kPresent be the result of calling the
+ // HasProperty internal method of o with argument Pk.
+ // This step can be combined with c
+ // c. If kPresent is true, then
+ // i. Let elementK be the result of calling the Get
+ // internal method of o with the argument ToString(k).
+ // ii. Let same be the result of applying the
+ // Strict Equality Comparison Algorithm to
+ // searchElement and elementK.
+ // iii. If same is true, return k.
+ if (k in o &amp;&amp; o[k] === searchElement) {
+ return k;
+ }
+ k++;
+ }
+ return -1;
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.14', 'Array.prototype.indexOf')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.indexof', 'Array.prototype.indexOf')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.indexof', 'Array.prototype.indexOf')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.indexOf")}}</p>
+</div>
+
+<h2 id="相容性備註">相容性備註</h2>
+
+<ul>
+ <li>Starting with Firefox 47 {{geckoRelease(47)}},  this method will no longer return <code>-0</code>. For example, <code>[0].indexOf(0, -0)</code> will now always return <code>+0</code> ({{bug(1242043)}}).</li>
+</ul>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.lastIndexOf()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.indexOf()")}}</li>
+ <li>{{jsxref("String.prototype.indexOf()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html
new file mode 100644
index 0000000000..f610cd1f54
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/isarray/index.html
@@ -0,0 +1,134 @@
+---
+title: Array.isArray()
+slug: Web/JavaScript/Reference/Global_Objects/Array/isArray
+tags:
+ - Array
+ - ECMAScript5
+ - JavaScript
+ - Method
+ - Reference
+ - polyfill
+ - 方法
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/isArray
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Array.isArray()</strong></code> 函式會檢查傳入的值是否為一個 {{jsxref("Array")}}。</p>
+
+<pre class="brush: js">Array.isArray([1, 2, 3]); // true
+Array.isArray({foo: 123}); // false
+Array.isArray('foobar'); // false
+Array.isArray(undefined); // false
+</pre>
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<pre class="syntaxbox">Array.isArray(<var>obj</var>)</pre>
+
+<h3 id="Parameters" name="Parameters">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>要檢查的物件。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>若物件為 {{jsxref("Array")}} 回傳 <code>true</code>;否則回傳 <code>false</code>。</p>
+
+<h2 id="Description" name="Description">描述</h2>
+
+<p>檢查傳入的物件是否為陣列({{jsxref("Array")}}),如果是便回傳 <code>true</code>,否則回傳 <code>false</code>。</p>
+
+<p>更多細節請參考 <a href="http://web.mit.edu/jwalden/www/isArray.html">“Determining with absolute accuracy whether or not a JavaScript object is an array”</a>。</p>
+
+<h2 id="Examples" name="Examples">範例</h2>
+
+<pre class="brush: js">// 下方都回傳 true
+Array.isArray([]);
+Array.isArray([1]);
+Array.isArray(new Array());
+Array.isArray(new Array('a', 'b', 'c', 'd'));
+Array.isArray(new Array(3));
+// 小細節:Array.prototype 本身是陣列:
+Array.isArray(Array.prototype);
+
+// 下方都回傳 false
+Array.isArray();
+Array.isArray({});
+Array.isArray(null);
+Array.isArray(undefined);
+Array.isArray(17);
+Array.isArray('Array');
+Array.isArray(true);
+Array.isArray(false);
+Array.isArray({ __proto__: Array.prototype });
+</pre>
+
+<h3 id="instanceof_vs_isArray"><code>instanceof</code> vs <code>isArray</code></h3>
+
+<p>當檢查 <code>Array</code> 實例時,<code>Array.isArray</code> 相較於 <code>instanceof</code> 更加推薦,因為它可以穿透 <code>iframes</code>。</p>
+
+<pre class="brush: js">var iframe = document.createElement('iframe');
+document.body.appendChild(iframe);
+xArray = window.frames[window.frames.length-1].Array;
+var arr = new xArray(1,2,3); // [1,2,3]
+
+// 正確地檢查陣列型態
+Array.isArray(arr); // true
+// 有害地,因為它不能在 iframes 之間正常運作
+arr instanceof Array; // false
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>如果 <code>Array.isArray()</code> 不存在於您的環境,在其他程式碼前執行下列程式碼可建置 <code>Array.isArray()</code>。</p>
+
+<pre class="brush: js">if (!Array.isArray) {
+ Array.isArray = function(arg) {
+ return Object.prototype.toString.call(arg) === '[object Array]';
+ };
+}
+</pre>
+
+<h2 id="Specifications" name="Specifications">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.3.2', 'Array.isArray')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.isarray', 'Array.isArray')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.isarray', 'Array.isArray')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.isArray")}}</p>
+</div>
+
+<h2 id="See_also" name="See_also">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/join/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/join/index.html
new file mode 100644
index 0000000000..0beaecebdd
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/join/index.html
@@ -0,0 +1,109 @@
+---
+title: Array.prototype.join()
+slug: Web/JavaScript/Reference/Global_Objects/Array/join
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/join
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>join()</strong></code> 方法會將陣列(或一個<a href="/zh-TW/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects">類陣列(array-like)物件</a>)中所有的元素連接、合併成一個字串,並回傳此字串。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-join.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.join(<em>[</em><var>separator]</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>separator</code> {{optional_inline}}</dt>
+ <dd>用來隔開陣列中每個元素的字串。如果必要的話,separator 會自動被轉成字串型態。如果未傳入此參數,陣列中的元素將預設用英文逗號(「,」)隔開。如果 <code>separator</code> 是空字串,合併後,元素間不會有任何字元。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個合併所有陣列元素的字串。假如 <code><em>arr</em>.length</code> 為 <code>0</code>,將回傳空字串。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>將所有陣列中的元素轉成字串型態後,連接合併成一個字串。任何 <code>undefined</code> 或 <code>null</code> 的元素都會被視為空字串處理。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="舉例四種合併用法">舉例四種合併用法</h3>
+
+<p>下方的範例中,首先宣告一個陣列—<code>a</code>,其中有三個元素。接著分別用:預設值、逗號、加號和空字串將陣列連接。</p>
+
+<pre class="brush: js">var a = ['Wind', 'Rain', 'Fire'];
+a.join(); // 'Wind,Rain,Fire'
+a.join(', '); // 'Wind, Rain, Fire'
+a.join(' + '); // 'Wind + Rain + Fire'
+a.join(''); // 'WindRainFire'</pre>
+
+<h3 id="合併一個類陣列(array-like)物件">合併一個類陣列(array-like)物件</h3>
+
+<p>下方的範例將合併一個類陣列(array-like)物件(<code><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/arguments">arguments</a></code>),藉由 {{jsxref("Function.prototype.call")}} 來呼叫 <code>Array.prototype.join</code>。</p>
+
+<pre class="brush: js">function f(a, b, c) {
+ var s = Array.prototype.join.call(arguments);
+ console.log(s); // '<span class="message-body-wrapper"><span class="message-flex-body"><span class="devtools-monospace message-body"><span class="objectBox objectBox-string">1,a,true'</span></span></span></span>
+}
+f(1, 'a', true);
+//expected output: "1,a,true"
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.5', 'Array.prototype.join')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.join', 'Array.prototype.join')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.join', 'Array.prototype.join')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.join")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.split()")}}</li>
+ <li>{{jsxref("Array.prototype.toString()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.join()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/keys/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/keys/index.html
new file mode 100644
index 0000000000..fa71299ecb
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/keys/index.html
@@ -0,0 +1,76 @@
+---
+title: Array.prototype.keys()
+slug: Web/JavaScript/Reference/Global_Objects/Array/keys
+tags:
+ - Array
+ - ECMAScript 2015
+ - Iterator
+ - JavaScript
+ - Method
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/keys
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>keys()</strong></code> 方法會回傳一個包含陣列中的每一個索引之鍵(keys)的新 <code><strong>Array Iterator</strong></code> 物件。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-keys.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.keys()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 {{jsxref("Array")}} 迭代器(iterator)物件。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="鍵迭代器不會乎略陣列中的空元素">鍵迭代器不會乎略陣列中的空元素</h3>
+
+<pre class="brush: js">var arr = ['a', , 'c'];
+var sparseKeys = Object.keys(arr);
+var denseKeys = [...arr.keys()];
+console.log(sparseKeys); // ['0', '2']
+console.log(denseKeys); // [0, 1, 2]
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.keys', 'Array.prototype.keys')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.keys', 'Array.prototype.keys')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.keys")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.values()")}}</li>
+ <li>{{jsxref("Array.prototype.entries()")}}</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols">迭代協議</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/lastindexof/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/lastindexof/index.html
new file mode 100644
index 0000000000..930b45d3e3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/lastindexof/index.html
@@ -0,0 +1,168 @@
+---
+title: Array.prototype.lastIndexOf()
+slug: Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
+tags:
+ - Array
+ - ECMAScript 5
+ - JavaScript
+ - Method
+ - Prototype
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>lastIndexOf()</strong></code> 方法會回傳給定元素於陣列中最後一個被找到之索引,若不存在於陣列中則回傳 -1。搜尋的方向為由陣列尾部向後(即向前)尋找,啟始於 <code>fromIndex</code>。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-lastindexof.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.lastIndexOf(<var>searchElement</var>)
+<var>arr</var>.lastIndexOf(<var>searchElement</var>, <var>fromIndex</var>)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>searchElement</code></dt>
+ <dd>欲在陣列中搜尋的元素。</dd>
+ <dt><code>fromIndex</code> {{optional_inline}}</dt>
+ <dd>要由陣列尾部向後(即向前)搜尋的啟始索引。預設為陣列長度減一(<code>arr.length - 1</code>),即會搜尋整個陣列。假如索引大於等於陣列長度,會搜尋整個陣列。如果索引值為負數,會從陣列的最後一個往回算,最後一個的索引值為 -1,以此類推。注意:儘管往回算,但依然會從右往左全部搜尋。如果負數索引值在回頭計算之後仍然小於 0,將會回傳 -1,即不會搜尋陣列。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>在陣列中找到的最後一個元素索引值;沒找到則為 <strong>-1</strong>。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>lastIndexOf</code> compares <code>searchElement</code> to elements of the Array using <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Using_the_Equality_Operators">strict equality</a> (the same method used by the ===, or triple-equals, operator).</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_lastIndexOf">使用 <code>lastIndexOf</code></h3>
+
+<p>The following example uses <code>lastIndexOf</code> to locate values in an array.</p>
+
+<pre class="brush: js">var numbers = [2, 5, 9, 2];
+numbers.lastIndexOf(2); // 3
+numbers.lastIndexOf(7); // -1
+numbers.lastIndexOf(2, 3); // 3
+numbers.lastIndexOf(2, 2); // 0
+numbers.lastIndexOf(2, -2); // 0
+numbers.lastIndexOf(2, -1); // 3
+</pre>
+
+<h3 id="尋找該元素所有出現在陣列中的位置">尋找該元素所有出現在陣列中的位置</h3>
+
+<p>The following example uses <code>lastIndexOf</code> to find all the indices of an element in a given array, using {{jsxref("Array.prototype.push", "push")}} to add them to another array as they are found.</p>
+
+<pre class="brush: js">var indices = [];
+var array = ['a', 'b', 'a', 'c', 'a', 'd'];
+var element = 'a';
+var idx = array.lastIndexOf(element);
+while (idx != -1) {
+ indices.push(idx);
+ idx = (idx &gt; 0 ? array.lastIndexOf(element, idx - 1) : -1);
+}
+
+console.log(indices);
+// [4, 2, 0]
+</pre>
+
+<p>Note that we have to handle the case <code>idx == 0</code> separately here because the element will always be found regardless of the <code>fromIndex</code> parameter if it is the first element of the array. This is different from the {{jsxref("Array.prototype.indexOf", "indexOf")}} method.</p>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>lastIndexOf</code> was added to the ECMA-262 standard in the 5th edition; as such it may not be present in other implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of <code>lastIndexOf</code> in implementations which do not natively support it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming {{jsxref("Object")}}, {{jsxref("TypeError")}}, {{jsxref("Number")}}, {{jsxref("Math.floor")}}, {{jsxref("Math.abs")}}, and {{jsxref("Math.min")}} have their original values.</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.15
+// Reference: http://es5.github.io/#x15.4.4.15
+if (!Array.prototype.lastIndexOf) {
+ Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
+ 'use strict';
+
+ if (this === void 0 || this === null) {
+ throw new TypeError();
+ }
+
+ var n, k,
+ t = Object(this),
+ len = t.length &gt;&gt;&gt; 0;
+ if (len === 0) {
+ return -1;
+ }
+
+ n = len - 1;
+ if (arguments.length &gt; 1) {
+ n = Number(arguments[1]);
+ if (n != n) {
+ n = 0;
+ }
+ else if (n != 0 &amp;&amp; n != (1 / 0) &amp;&amp; n != -(1 / 0)) {
+ n = (n &gt; 0 || -1) * Math.floor(Math.abs(n));
+ }
+ }
+
+ for (k = n &gt;= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k &gt;= 0; k--) {
+ if (k in t &amp;&amp; t[k] === searchElement) {
+ return k;
+ }
+ }
+ return -1;
+ };
+}
+</pre>
+
+<p>Again, note that this implementation aims for absolute compatibility with <code>lastIndexOf</code> in Firefox and the SpiderMonkey JavaScript engine, including in several cases which are arguably edge cases. If you intend to use this in real-world applications, you may be able to calculate <code>from</code> with less complicated code if you ignore those cases.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.15', 'Array.prototype.lastIndexOf')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.lastindexof', 'Array.prototype.lastIndexOf')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.lastindexof', 'Array.prototype.lastIndexOf')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.lastIndexOf")}}</p>
+</div>
+
+<h2 id="相容性備註">相容性備註</h2>
+
+<ul>
+ <li>Starting with Firefox 47 {{geckoRelease(47)}},  this method will no longer return <code>-0</code>. For example, <code>[0].lastIndexOf(0, -0)</code> will now always return <code>+0</code> ({{bug(1242043)}}).</li>
+</ul>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.indexOf()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.lastIndexOf()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/length/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/length/index.html
new file mode 100644
index 0000000000..453564d528
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/length/index.html
@@ -0,0 +1,131 @@
+---
+title: Array.length
+slug: Web/JavaScript/Reference/Global_Objects/Array/length
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/length
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>length</strong></code> 為<code>Array物件的屬性</code> ,可供設定或回傳該陣列實體中包含的元素個數。其值必為一大於零、32位元、且恆大於該陣列最大索引數的正整數。</p>
+
+<pre class="brush: js notranslate">var items = ['shoes', 'shirts', 'socks', 'sweaters'];
+items.length;
+
+// returns 4</pre>
+
+<h2 id="描述">描述</h2>
+
+<p><code>length</code> 屬性的值必為一正整數,其值必介於 0 ~ 2<sup>32</sup> (不包含)之間.</p>
+
+<pre class="brush: js notranslate">var namelistA = new Array(4294967296); //2<sup>32</sup><sup> = </sup>4294967296
+var namelistC = new Array(-100) //負數
+
+console.log(namelistA.length); //RangeError: Invalid array length
+console.log(namelistC.length); //RangeError: Invalid array length
+
+
+
+var namelistB = [];
+namelistB.length = Math.pow(2,32)-1; //將長度設定介於 0 ~ 2<sup>32 </sup>-1
+console.log(namelistB.length);
+
+//4294967295</pre>
+
+<p>你可以透過改變 <code>length</code> 屬性來改變陣列的長度。當你透過 <code>length</code> 屬性來增加陣列的長度時,陣列中實際的元素也會隨之增加。舉例來說,當你將 array.length 由 2 增加為3,則改動後該陣列即擁有3個元素,該新增的元素則會是一個不可迭代(non-iterable)的空槽(empty slot)。</p>
+
+<pre class="notranslate">const arr = [1, 2];
+console.log(arr);
+// [ 1, 2 ]
+
+arr.length = 5; // 將arr的length由2改成5
+console.log(arr);
+// [ 1, 2, &lt;3 empty items&gt; ]
+
+arr.forEach(element =&gt; console.log(element)); // 空元素無法被迭代
+// 1
+// 2</pre>
+
+<p>如上所見,<code>length</code> 屬性不盡然代表陣列中所有已定義的元素個數。詳見 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Relationship_between_length_and_numerical_properties" title="Relationship between length and numerical properties">length 與數值屬性的關係</a>。</p>
+
+<p>{{js_property_attributes(1, 0, 0)}}</p>
+
+<div>
+<ul>
+ <li><code>Writable</code>: 如果此屬性值為<code>false</code>,則該屬性的內容值無法被改動。</li>
+ <li><code>Configurable</code>: 如果此屬性值為<code>false</code>,任何刪除屬性或更改其屬性的操作(<code>Writable</code>, <code>Configurable</code>, or <code>Enumerable</code>)皆會失敗。</li>
+ <li><code>Enumerable</code>: 如果此屬性值為<code>true</code>,該內容值可倍 <a href="/en-US/docs/Web/JavaScript/Reference/Statements/for">for</a> 或 <a href="/en-US/docs/Web/JavaScript/Reference/Statements/for...in">for..in</a> 迴圈迭代處理。</li>
+</ul>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="對陣列進行迭代處理">對陣列進行迭代處理</h3>
+
+<p>以下範例中, 陣列 <code>numbers</code> 透過 <code>length</code> 屬性進行迭代操作,並將其內容值加倍。</p>
+
+<pre class="brush: js notranslate">var numbers = [1, 2, 3, 4, 5];
+var length = numbers.length;
+for (var i = 0; i &lt; length; i++) {
+ numbers[i] *= 2;
+}
+// numbers 內容值變為 [2, 4, 6, 8, 10]
+</pre>
+
+<h3 id="縮減陣列">縮減陣列</h3>
+
+<p>以下範例中, 陣列 <code>numbers</code>  的長度若大於 3,則將其長度縮減至 3。</p>
+
+<pre class="brush: js notranslate">var numbers = [1, 2, 3, 4, 5];
+
+if (numbers.length &gt; 3) {
+  numbers.length = 3;
+}
+
+console.log(numbers); // [1, 2, 3]
+console.log(numbers.length); // 3
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.5.2', 'Array.length')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-properties-of-array-instances-length', 'Array.length')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-properties-of-array-instances-length', 'Array.length')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.length")}}</p>
+</div>
+
+<h2 id="其他">其他</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html
new file mode 100644
index 0000000000..d1838ce6ae
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/map/index.html
@@ -0,0 +1,320 @@
+---
+title: Array.prototype.map()
+slug: Web/JavaScript/Reference/Global_Objects/Array/map
+tags:
+ - Array
+ - ECMAScript 5
+ - ECMAScript6
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - polyfill
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/map
+---
+<div>{{JSRef}}</div>
+
+<p><span class="seoSummary"><code><strong>map()</strong></code> 方法會建立一個新的陣列,其內容為原陣列的每一個元素經由回呼函式運算後所回傳的結果之集合。</span></p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-map.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">let <var>new_array</var> = <var>arr</var>.map(function <var>callback</var>( <var>currentValue</var>[, <var>index</var>[, <var>array</var>]]) {
+ // return element for new_array
+}[, <var>thisArg</var>])
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>
+ <p>呼叫 <code><var>arr</var></code> 所有元素的回呼函式。新數值會在每次執行 <code><var>callback</var></code> 時加到 <code><var>new_array</var></code>。</p>
+
+ <p><code><var>callback</var></code> 函式可傳入以下三個參數:</p>
+
+ <dl>
+ <dt></dt>
+ <dt><code>currentValue</code></dt>
+ <dd>原陣列目前所迭代處理中的元素。</dd>
+ <dt><code>index</code>{{optional_inline}}</dt>
+ <dd>原陣列目前所迭代處理中的元素之索引。</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>map</code> 方法的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg</code>{{optional_inline}}</dt>
+ <dd>選擇性的參數。執行 <code>callback</code> 回呼函式的 <code>this</code> 值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個所有元素皆為回呼函式運算結果的新陣列。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>map</code> 會將所有陣列中的元素依序<strong>分別傳入一次</strong>至 <code><var>callback</var></code> 函式當中,並以此回呼函式每一次被呼叫的回傳值來建構一個新的陣列。<code>callback</code> 函式只會於陣列目前迭代之索引有指派值時(包含{{jsxref("undefined")}})被調用,而在該陣列索引沒有元素時(即未被設定的索引:已被刪除或從未被賦值)並不會呼叫回呼函式。</p>
+
+<p>它<em>並不能</em>呼叫以下元素:</p>
+
+<ul>
+ <li>不存在的索引、</li>
+ <li>沒被刪除、</li>
+ <li>沒被賦值。</li>
+</ul>
+
+<h3 id="什麼時候不要用_map">什麼時候<em>不要用</em> map()</h3>
+
+<p>因為 <code>map</code> 會建立新的陣列,如果在不想建立新陣列時使用該方法,就會變成反模式(anti-pattern):這種情況下,要使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach"><code>forEach</code></a> 或 <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of"><code>for-of</code></a>。</p>
+
+<p>以下情況不應該使用 <code>map</code>;</p>
+
+<ol>
+ <li>不使用回傳的新陣列,</li>
+ <li>或/且不需要回傳新陣列。</li>
+</ol>
+
+<p><code>callback</code> 函式於被調用時會傳入三個參數:元素值、元素之索引、以及被迭代的陣列物件。</p>
+
+<p>若有提供 <code>thisArg</code> 參數予 <code>map</code> 方法,<code>thisArg</code> 將會被當作回呼函式的 <code>this</code> 值,否則 <code>this</code> 會是 {{jsxref("undefined")}}。<code>callback</code> 的最終 <code>this</code> 值是依據<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/this">函式的 <code>this</code> 規則</a>來決定。</p>
+
+<p><code>map</code> 不會修改呼叫它的原始陣列(雖然在 <code>callback</code> 執行時有可能會這麼做)。</p>
+
+<p>由 <code>map</code> 方法所回傳之新陣列的範圍,於 <code>callback</code> 函式第一次被調用之前就已經被設定。而在呼叫 <code>map</code> 之後才加至原始陣列中的元素,將不會傳入 <code>callback</code> 當中。假如原始陣列中元素的值改變了,則 <code>callback</code> 得到此元素的值將會是 <code>map</code> 傳入元素當下的值。而在呼叫 <code>map</code> 之後、且於被 <code>map</code> 傳入 <code>callback</code> 之前就被刪除的原始陣列元素,並不會被 <code>map</code> 迭代到。<br>
+ <br>
+ 依據規範中定義的演算法,若呼叫 <code>map</code> 方法的原始陣列為一稀疏(sparse)陣列,則回傳的新陣列也會是在同樣索引中留空的稀疏陣列。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="把一個數字陣列轉換成對應的開根號後的數字陣列">把一個數字陣列轉換成對應的開根號後的數字陣列</h3>
+
+<p>以下的程式碼把一個數字陣列(array of numbers) 轉換成一個 <strong>新的</strong>以該數字陣列裡的一個個數做開根號計算的數字陣列.</p>
+
+<pre class="brush: js">var numbers = [1, 4, 9];
+var roots = numbers.map(Math.sqrt); //map會return一個新的array
+// roots 現在是 [1, 2, 3]
+/* numbers 還是 [1, 4, 9],這證明了 map() 不會去變動到 numbers 的值,
+ map 內部是做了 immutable 的機制,Array.prototype 底下的這些高階函式
+  大多都具有這樣函數式編程裡非常注重的特性 - immutable,不會去改變資料
+  來源本身原有的值
+*/ </pre>
+
+<h3 id="使用_map_將陣列中的物件變更格式">使用 map 將陣列中的物件變更格式</h3>
+
+<p>以下程式碼取出一陣列,將其中物件變更格式後建立為一個新的陣列並傳回。</p>
+
+<pre class="brush: js">var kvArray = [{key: 1, value: 10},
+ {key: 2, value: 20},
+ {key: 3, value: 30}];
+
+var reformattedArray = kvArray.map(function(obj) {
+ var rObj = {};
+ rObj[obj.key] = obj.value;
+ return rObj;
+});
+
+// reformattedArray 現在是 [{1: 10}, {2: 20}, {3: 30}],
+
+// kvArray 仍然是:
+// [{key: 1, value: 10},
+// {key: 2, value: 20},
+// {key: 3, value: 30}]
+</pre>
+
+<h3 id="使用帶參數的函式將一數字陣列進行對應">使用帶參數的函式將一數字陣列進行對應</h3>
+
+<p>以下程式碼示範如何使用帶有一個參數的函式來操作 map。這個參數會自動地逐一取出原始陣列中各個元素來使用。</p>
+
+<pre class="brush: js">var numbers = [1, 4, 9];
+var doubles = numbers.map(function(num) {
+ return num * 2;
+});
+
+// doubles 現在是 [2, 8, 18]
+// numbers 仍然是 [1, 4, 9]
+</pre>
+
+<h3 id="使用_map_於泛型陣列">使用 <code>map</code> 於泛型陣列</h3>
+
+<p>以下範例示範如何將一個 {{jsxref("String")}} 陣列轉換為 byte 陣列:</p>
+
+<pre class="brush: js">var map = Array.prototype.map;
+var a = map.call('Hello World', function(x) {
+ return x.charCodeAt(0);
+});
+// a 現在等於 [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]
+</pre>
+
+<h3 id="使用_map_遍歷_querySelectorAll">使用 <code>map</code> 遍歷 <code>querySelectorAll</code></h3>
+
+<p>本範例將展示如何遍歷由 <code>querySelectorAll</code> 所產生的物件。我們將得到所有的選項、並印在主控台上:</p>
+
+<pre class="brush: js">var elems = document.querySelectorAll('select option:checked');
+var values = Array.prototype.map.call(elems, function(obj) {
+ return obj.value;
+});
+</pre>
+
+<p>如果用上 {{jsxref("Array.from()")}} 方法的話會更簡單。</p>
+
+<h3 id="棘手的範例">棘手的範例</h3>
+
+<p><a href="http://www.wirfs-brock.com/allen/posts/166">(透過連結的部落格啟發)</a></p>
+
+<p>透過一個(被遍歷元素的)參數叫出回調是個常見的用法。有些函式也常常在含有其他可選參數的情況下,使用上一個參數。這種行為常常會給人帶來困惑。</p>
+
+<pre class="brush: js">// Consider:
+['1', '2', '3'].map(parseInt);
+// 以為會是 [1, 2, 3] 嗎
+// 其實是 [1, NaN, NaN]
+
+// parseInt 通常只用上一個參數 argument,但他其實用了兩個:
+// 第一個是表達式,第二個則是進位數。
+// 對該回呼函式來說 Array.prototype.map 帶了三個參數:
+// 元素、索引、陣列
+// 第三個參數會被 parseInt 忽略,但它可不會忽略第二個,
+// 因此可能造成困惑。可以去看上面提到的部落格文章以獲知詳情。
+
+function returnInt(element) {
+ return parseInt(element, 10);
+}
+
+['1', '2', '3'].map(returnInt); // [1, 2, 3]
+// Actual result is an array of numbers (as expected)
+
+// Same as above, but using the concise arrow function syntax
+['1', '2', '3'].map( str =&gt; parseInt(str) );
+
+// A simpler way to achieve the above, while avoiding the "gotcha":
+['1', '2', '3'].map(Number); // [1, 2, 3]
+// but unlike `parseInt` will also return a float or (resolved) exponential notation:
+['1.1', '2.2e2', '3e300'].map(Number); // [1.1, 220, 3e+300]
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>map</code> was added to the ECMA-262 standard in the 5th edition; as such it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of <code>map</code> in implementations which do not natively support it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming {{jsxref("Object")}}, {{jsxref("TypeError")}}, and {{jsxref("Array")}} have their original values and that <code>callback.call</code> evaluates to the original value of <code>{{jsxref("Function.prototype.call")}}</code>.</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.19
+// Reference: http://es5.github.io/#x15.4.4.19
+if (!Array.prototype.map) {
+
+ Array.prototype.map = function(callback/*, thisArg*/) {
+
+ var T, A, k;
+
+ if (this == null) {
+ throw new TypeError('this is null or not defined');
+ }
+
+ // 1. Let O be the result of calling ToObject passing the |this|
+ // value as the argument.
+ var O = Object(this);
+
+ // 2. Let lenValue be the result of calling the Get internal
+ // method of O with the argument "length".
+ // 3. Let len be ToUint32(lenValue).
+ var len = O.length &gt;&gt;&gt; 0;
+
+ // 4. If IsCallable(callback) is false, throw a TypeError exception.
+ // See: http://es5.github.com/#x9.11
+ if (typeof callback !== 'function') {
+ throw new TypeError(callback + ' is not a function');
+ }
+
+ // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
+ if (arguments.length &gt; 1) {
+ T = arguments[1];
+ }
+
+ // 6. Let A be a new array created as if by the expression new Array(len)
+ // where Array is the standard built-in constructor with that name and
+ // len is the value of len.
+ A = new Array(len);
+
+ // 7. Let k be 0
+ k = 0;
+
+ // 8. Repeat, while k &lt; len
+ while (k &lt; len) {
+
+ var kValue, mappedValue;
+
+ // a. Let Pk be ToString(k).
+ // This is implicit for LHS operands of the in operator
+ // b. Let kPresent be the result of calling the HasProperty internal
+ // method of O with argument Pk.
+ // This step can be combined with c
+ // c. If kPresent is true, then
+ if (k in O) {
+
+ // i. Let kValue be the result of calling the Get internal
+ // method of O with argument Pk.
+ kValue = O[k];
+
+ // ii. Let mappedValue be the result of calling the Call internal
+ // method of callback with T as the this value and argument
+ // list containing kValue, k, and O.
+ mappedValue = callback.call(T, kValue, k, O);
+
+ // iii. Call the DefineOwnProperty internal method of A with arguments
+ // Pk, Property Descriptor
+ // { Value: mappedValue,
+ // Writable: true,
+ // Enumerable: true,
+ // Configurable: true },
+ // and false.
+
+ // In browsers that support Object.defineProperty, use the following:
+ // Object.defineProperty(A, k, {
+ // value: mappedValue,
+ // writable: true,
+ // enumerable: true,
+ // configurable: true
+ // });
+
+ // For best browser support, use the following:
+ A[k] = mappedValue;
+ }
+ // d. Increase k by 1.
+ k++;
+ }
+
+ // 9. return A
+ return A;
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.map', 'Array.prototype.map')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.map")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Map")}} object</li>
+ <li>{{jsxref("Array.from()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/of/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/of/index.html
new file mode 100644
index 0000000000..31118bbeb6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/of/index.html
@@ -0,0 +1,98 @@
+---
+title: Array.of()
+slug: Web/JavaScript/Reference/Global_Objects/Array/of
+tags:
+ - Array
+ - ECMAScript 2015
+ - JavaScript
+ - Method
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/of
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Array.of()</strong></code> 方法會由引數(arguments)的數量來建立一個新的 <code>Array</code> 實體,而不管引數的數量或類型為何。</p>
+
+<p><code><strong>Array.of()</strong></code> 與 <code><strong>Array</strong></code> 建構式之間的不同在於如何處理整數引數:<code><strong>Array.of(7)</strong></code> 會建立一個擁有單個元素—<code>7</code>—的陣列,而 <code><strong>Array(7)</strong></code> 會建立一個 <code>length</code> 屬性值為 7 的空陣列(<strong>註:</strong>這意味著這個陣列有 7 個空缺欄位(empty slots),而非 7 個值為 <code>undefined</code> 的欄位)。</p>
+
+<pre class="brush: js">Array.of(7); // [7]
+Array.of(1, 2, 3); // [1, 2, 3]
+
+Array(7); // [ , , , , , , ]
+Array(1, 2, 3); // [1, 2, 3]
+</pre>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">Array.of(<var>element0</var>[, <var>element1</var>[, ...[, <var>elementN</var>]]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>element<em>N</em></code></dt>
+ <dd>要用來成為新建立之陣列的元素。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 {{jsxref("Array")}} 實體。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>此函式是 ECMAScript 2015 標準的一部分。更多資訊可參考 <a href="https://gist.github.com/rwaldron/1074126"><code>Array.of</code> and <code>Array.from</code> proposal</a> 以及 <a href="https://gist.github.com/rwaldron/3186576"><code>Array.of</code> polyfill</a>。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">Array.of(1); // [1]
+Array.of(1, 2, 3); // [1, 2, 3]
+Array.of(undefined); // [undefined]
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>若所有執行環境沒有原生支援,可以在其他程式之前先執行以下程式碼來建立 <code>Array.of()</code>。</p>
+
+<pre class="brush: js">if (!Array.of) {
+ Array.of = function() {
+ return Array.prototype.slice.call(arguments);
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.of', 'Array.of')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.of', 'Array.of')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.of")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("Array.from()")}}</li>
+ <li>{{jsxref("TypedArray.of()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/pop/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/pop/index.html
new file mode 100644
index 0000000000..3124fa26bc
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/pop/index.html
@@ -0,0 +1,98 @@
+---
+title: Array.prototype.pop()
+slug: Web/JavaScript/Reference/Global_Objects/Array/pop
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/pop
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>pop()</strong></code> 方法會移除並回傳陣列的<strong>最後一個</strong>元素。此方法會改變陣列的長度。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-pop.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.pop()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>自陣列中移除的元素;若陣列為空,則為 {{jsxref("undefined")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>pop</code> 方法會移除陣列中的最後一個元素,並將該值回傳給呼叫者。</p>
+
+<p><code>pop</code> 方法被刻意設計為具通用性;此方法可以藉由 {{jsxref("Function.call", "called", "", 1)}} 或 {{jsxref("Function.apply", "applied", "", 1)}} 應用於類似陣列的物件上。若欲應用此方法的物件不包含代表一系列啟始為零之數字屬性序列長度的 <code>length</code> 屬性,可能是不具任何意義的行為。</p>
+
+<p>如果於空陣列呼叫 <code>pop()</code>,將會回傳 {{jsxref("undefined")}}。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="移除陣列的最後一個元素">移除陣列的最後一個元素</h3>
+
+<p>下面的程式碼為一個包含四個元素的 <code>myFish</code> 陣列,接著移除此陣列的最後一個元素。</p>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
+
+var popped = myFish.pop();
+
+console.log(myFish); // ['angel', 'clown', 'mandarin' ]
+
+console.log(popped); // 'sturgeon'</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.6', 'Array.prototype.pop')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.pop', 'Array.prototype.pop')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.pop', 'Array.prototype.pop')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.pop")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.push()")}}</li>
+ <li>{{jsxref("Array.prototype.shift()")}}</li>
+ <li>{{jsxref("Array.prototype.unshift()")}}</li>
+ <li>{{jsxref("Array.prototype.concat()")}}</li>
+ <li>{{jsxref("Array.prototype.splice()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/push/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/push/index.html
new file mode 100644
index 0000000000..a506ad15b6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/push/index.html
@@ -0,0 +1,143 @@
+---
+title: Array.prototype.push()
+slug: Web/JavaScript/Reference/Global_Objects/Array/push
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/push
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>push()</strong></code> 方法會添加一個或多個元素至陣列的末端,並且回傳陣列的新長度。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-push.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.push(<var>element1</var>[, ...[, <var>elementN</var>]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>element<em>N</em></code></dt>
+ <dd>欲添加至陣列末端的元素。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>呼叫此方法之物件的新 {{jsxref("Array.length", "length")}} 屬性值。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>push</code> 方法會將一或多個值加入至一個陣列中。</p>
+
+<p><code>push</code> 方法被刻意設計為具通用性;此方法可以藉由 {{jsxref("Function.call", "call()")}} 或 {{jsxref("Function.apply", "apply()")}} 應用於類似陣列的物件上。<code>push</code> 方法憑借著物件的 <code>length</code> 屬性來判斷從何處開始插入給定的值。如果 <code>length</code> 屬性無法被轉為數字,則索引值會使用 0。這包括了 <code>length</code> 可能不存在的狀況,在這個情況下 <code>length</code> 屬性也將被建立於物件中。</p>
+
+<p>唯一的原生類陣列(array-like)物件為{{jsxref("Global_Objects/String", "字串", "", 1)}},但他們不適合用於此方法,因為字串是不可變的(immutable)。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="將複數個元素添加至陣列">將複數個元素添加至陣列</h3>
+
+<p>以下的程式碼會建立含有兩個元素的陣列 <code>sports</code>,接著再增加兩個元素至陣列中。新的長度以變數 <code>total</code> 表示。</p>
+
+<pre class="brush: js">var sports = ['soccer', 'baseball'];
+var total = sports.push('football', 'swimming');
+
+console.log(sports); // ['soccer', 'baseball', 'football', 'swimming']
+console.log(total); // 4
+</pre>
+
+<h3 id="合併兩個陣列">合併兩個陣列</h3>
+
+<p>這個範例使用 {{jsxref("Function.apply", "apply()")}} 自第二個陣列中增加所有的元素至第一個陣列。</p>
+
+<p>如果第二個陣列(範例中的 <code>moreVegs</code>)非常大,就不要使用這個方法。因為一個函式能取得的參數之最大數量是受到實作限制的。詳細請參閱 {{jsxref("Function.apply", "apply()")}}。</p>
+
+<pre class="brush: js">var vegetables = ['parsnip', 'potato'];
+var moreVegs = ['celery', 'beetroot'];
+
+// Merge the second array into the first one
+// Equivalent to vegetables.push('celery', 'beetroot');
+Array.prototype.push.apply(vegetables, moreVegs);
+
+console.log(vegetables); // ['parsnip', 'potato', 'celery', 'beetroot']
+</pre>
+
+<h3 id="以類陣列(array-like)的方式操作物件">以類陣列(array-like)的方式操作物件</h3>
+
+<p>正如上面所提到的,<code>push</code> 被刻意設計為具通用性,我們可以善用這個優勢來處理物件。<code>Array.prototype.push</code> 可以在物件上運作良好,如本範例所示。請注意,我們不會建立一個陣列來儲存收集到的物件。相反地,我們將物件集合(collection)儲存於物件自己身上,並使用 <code>call</code> 來呼叫<code>Array.prototype.push</code> 使其認為我們正在處理一個陣列,讓方法可以繼續運作。感謝 JavaScript 允許我們使用這個方式去執行上下文。</p>
+
+<pre class="brush: js">var obj = {
+ length: 0,
+
+ addElem: function addElem(elem) {
+ // obj.length is automatically incremented
+ // every time an element is added.
+ [].push.call(this, elem);
+ }
+};
+
+// Let's add some empty objects just to illustrate.
+obj.addElem({});
+obj.addElem({});
+console.log(obj.length);
+// → 2
+</pre>
+
+<p>請注意雖然 <code>obj</code> 不是一個陣列,但 <code>push</code> 方法成功增加了 <code>obj</code> 的 <code>length</code> 屬性,就像我們在處理一個真正的陣列一樣。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.7', 'Array.prototype.push')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.push', 'Array.prototype.push')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.push', 'Array.prototype.push')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器支援度">瀏覽器支援度</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.push")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.pop()")}}</li>
+ <li>{{jsxref("Array.prototype.shift()")}}</li>
+ <li>{{jsxref("Array.prototype.unshift()")}}</li>
+ <li>{{jsxref("Array.prototype.concat()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html
new file mode 100644
index 0000000000..1f943d8dfa
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/reduce/index.html
@@ -0,0 +1,472 @@
+---
+title: Array.prototype.reduce()
+slug: Web/JavaScript/Reference/Global_Objects/Array/Reduce
+tags:
+ - Array
+ - ECMAScript 5
+ - JavaScript
+ - Method
+ - Prototype
+ - Reduce
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/Reduce
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>reduce()</strong></code> 方法將一個累加器及陣列中每項元素(由左至右)傳入回呼函式,將陣列化為單一值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-reduce.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.reduce(<var>callback[accumulator, currentValue, currentIndex, array], </var><var>initialValue</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>用於處理陣列中每個元素的函式,可傳入四個參數:
+ <dl>
+ <dt><code>accumulator</code></dt>
+ <dd>用來累積回呼函式回傳值的累加器(accumulator)或 <code>initialValue</code>(若有提供的話,詳如下敘)。累加器是上一次呼叫後,所回傳的累加數值。</dd>
+ <dt><code>currentValue</code></dt>
+ <dd>原陣列目前所迭代處理中的元素。</dd>
+ <dt><code>currentIndex</code>{{optional_inline}}</dt>
+ <dd>原陣列目前所迭代處理中的元素之索引。若有傳入 <code>initialValue</code>,則由索引 0 之元素開始,若無則自索引 1 之元素開始。</dd>
+ <dt><code>array</code>{{optional_inline}}</dt>
+ <dd>呼叫 <code>reduce()</code> 方法的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>initialValue</code>{{optional_inline}}</dt>
+ <dd>於第一次呼叫 <code>callback</code> 時要傳入的累加器初始值。若沒有提供初始值,則原陣列的第一個元素將會被當作初始的累加器。假如於一個空陣列呼叫 <code>reduce()</code> 方法且沒有提供累加器初始值,將會發生錯誤。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>簡化後的結果值。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>reduce()</code> 會對每一個目前迭代到的陣列元素(除了空值以外)執行 <code>callback</code> 函式,回呼函式會接收四個參數:</p>
+
+<ul>
+ <li><code>accumulator</code></li>
+ <li><code>currentValue</code></li>
+ <li><code>currentIndex</code></li>
+ <li><code>array</code></li>
+</ul>
+
+<p>當回呼函式第一次被呼叫時,<code>accumulator</code> 與 <code>currentValue</code> 的值可能為兩種不同的狀況:若在呼叫 <code>reduce()</code> 時有提供 <code>initialValue</code>,則 <code>accumulator</code> 將會等於 <code>initialValue</code>,且 <code>currentValue</code> 會等於陣列中的第一個元素值;若沒有提供 <code>initialValue</code>,則 <code>accumulator</code> 會等於陣列的第一個元素值,且 <code>currentValue</code> 將會等於陣列的第二個元素值。</p>
+
+<div class="note">
+<p><strong>備註:</strong>假如 <code>initialValue</code> 未被提供,<code>reduce()</code> 將會跳過第一個陣列索引,從陣列索引 1 開始執行回呼函式。若有提供 <code>initialValue</code>,則會由陣列索引 0 開始執行。</p>
+</div>
+
+<p>若陣列為空且沒有提供 <code>initialValue</code>,將會拋出 {{jsxref("TypeError")}}。假如陣列只有一個元素(無論其索引位置為何)並且沒有提供 <code>initialValue</code>,或如果提供了 <code>initialValue</code> 但陣列為空,則此唯一的值將會被直接回傳<em>而不會呼叫 <code>callback</code> 函式</em>。</p>
+
+<p>提供累加器初始值通常較為安全,因為在沒有傳入 <code>initialValue</code> 的情況下會有三種可能的輸出結果,如下列範例:</p>
+
+<pre class="brush: js">var maxCallback = ( acc, cur ) =&gt; Math.max( acc.x, cur.x );
+var maxCallback2 = ( max, cur ) =&gt; Math.max( max, cur );
+
+// reduce() without initialValue
+[ { x: 22 }, { x: 42 } ].reduce( maxCallback ); // 42
+[ { x: 22 } ].reduce( maxCallback ); // { x: 22 }
+[ ].reduce( maxCallback ); // TypeError
+
+// map/reduce; better solution, also works for empty or larger arrays
+[ { x: 22 }, { x: 42 } ].map( el =&gt; el.x )
+ .reduce( maxCallback2, -Infinity );
+</pre>
+
+<h3 id="reduce()_如何運作">reduce() 如何運作</h3>
+
+<p>假設 <code>reduce()</code> 以下例方式使用:</p>
+
+<pre class="brush: js">[0, 1, 2, 3, 4].reduce(
+  function (
+<code> accumulator,</code>
+  <code>currentValue</code>,
+  <code>currentIndex</code>,
+  array
+ ) {
+ return <code>accumulator</code> + currentValue;
+ }
+);
+</pre>
+
+<p>所傳入的回呼函式將被呼叫四次,所傳入的參數與回傳值如下所示:</p>
+
+<table>
+ <thead>
+ <tr>
+ <th scope="col"><code>callback</code></th>
+ <th scope="col"><code>accumulator</code></th>
+ <th scope="col"><code>currentValue</code></th>
+ <th scope="col"><code>currentIndex</code></th>
+ <th scope="col"><code>array</code></th>
+ <th scope="col">return value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th scope="row">first call</th>
+ <td><code>0</code></td>
+ <td><code>1</code></td>
+ <td><code>1</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>1</code></td>
+ </tr>
+ <tr>
+ <th scope="row">second call</th>
+ <td><code>1</code></td>
+ <td><code>2</code></td>
+ <td><code>2</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>3</code></td>
+ </tr>
+ <tr>
+ <th scope="row">third call</th>
+ <td><code>3</code></td>
+ <td><code>3</code></td>
+ <td><code>3</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>6</code></td>
+ </tr>
+ <tr>
+ <th scope="row">fourth call</th>
+ <td><code>6</code></td>
+ <td><code>4</code></td>
+ <td><code>4</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>10</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<p><code>reduce()</code> 的最終回傳值將會是最後一次呼叫回呼函式的回傳值 (<code>10</code>)。</p>
+
+<p>你也可以傳入一個{{jsxref("Functions/Arrow_functions", "箭頭函式","",1)}}來替代一個完整的函式。下方的程式碼執行的結果將與前述例子相同。</p>
+
+<pre class="brush: js">[0, 1, 2, 3, 4].reduce( (prev, curr) =&gt; prev + curr );
+</pre>
+
+<p>如果你有提供第二個參數值給 <code>reduce()</code>,執行的結果如下:</p>
+
+<pre class="brush: js">[0, 1, 2, 3, 4].reduce(
+  (<code>accumulator</code>, currentValue, currentIndex, array) =&gt; {
+ return <code>accumulator</code> + currentValue;
+ },
+ 10
+);
+</pre>
+
+<table>
+ <thead>
+ <tr>
+ <th scope="col"><code>callback</code></th>
+ <th scope="col"><code>accumulator</code></th>
+ <th scope="col"><code>currentValue</code></th>
+ <th scope="col"><code>currentIndex</code></th>
+ <th scope="col"><code>array</code></th>
+ <th scope="col">return value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th scope="row">first call</th>
+ <td><code>10</code></td>
+ <td><code>0</code></td>
+ <td><code>0</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>10</code></td>
+ </tr>
+ <tr>
+ <th scope="row">second call</th>
+ <td><code>10</code></td>
+ <td><code>1</code></td>
+ <td><code>1</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>11</code></td>
+ </tr>
+ <tr>
+ <th scope="row">third call</th>
+ <td><code>11</code></td>
+ <td><code>2</code></td>
+ <td><code>2</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>13</code></td>
+ </tr>
+ <tr>
+ <th scope="row">fourth call</th>
+ <td><code>13</code></td>
+ <td><code>3</code></td>
+ <td><code>3</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>16</code></td>
+ </tr>
+ <tr>
+ <th scope="row">fifth call</th>
+ <td><code>16</code></td>
+ <td><code>4</code></td>
+ <td><code>4</code></td>
+ <td><code>[0, 1, 2, 3, 4]</code></td>
+ <td><code>20</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<p><code>reduce()</code> 執行的結果將會是 <code>20</code>。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="加總所有陣例之元素值">加總所有陣例之元素值</h3>
+
+<pre class="brush: js">var sum = [0, 1, 2, 3].reduce(function (a, b) {
+ return a + b;
+}, 0);
+// sum is 6
+</pre>
+
+<p>另外,也可以寫成箭頭函式:</p>
+
+<pre class="brush: js">var total = [ 0, 1, 2, 3 ].reduce(
+  ( acc, cur ) =&gt; acc + cur,
+  0
+);</pre>
+
+<h3 id="攤平一個多維陣列">攤平一個多維陣列</h3>
+
+<pre class="brush: js">var flattened = [[0, 1], [2, 3], [4, 5]].reduce(
+  function(a, b) {
+ return a.concat(b);
+ },
+  []
+);
+// flattened is [0, 1, 2, 3, 4, 5]
+</pre>
+
+<p>另外,也可以寫成箭頭函式:</p>
+
+<pre class="brush: js">var flattened = [[0, 1], [2, 3], [4, 5]].reduce(
+  ( acc, cur ) =&gt; acc.concat(cur),
+  []
+);
+</pre>
+
+<h3 id="計算相同元素數量並以物件鍵值顯示">計算相同元素數量並以物件鍵值顯示</h3>
+
+<pre class="brush: js">var names = ['Alice', 'Bob', 'Tiff', 'Bruce', 'Alice'];
+
+var countedNames = names.reduce(function (allNames, name) {
+ if (name in allNames) {
+ allNames[name]++;
+  }
+  else {
+  allNames[name] = 1;
+  }
+ return allNames;
+}, {});
+// countedNames is:
+// { 'Alice': 2, 'Bob': 1, 'Tiff': 1, 'Bruce': 1 }
+</pre>
+
+<h3 id="使用_spread_運算子與給定初始值,結合物件中的陣列元素">使用 spread 運算子與給定初始值,結合物件中的陣列元素</h3>
+
+<pre class="brush: js">// friends - an array of objects
+// where object field "books" - list of favorite books
+var friends = [{
+  name: 'Anna',
+  books: ['Bible', 'Harry Potter'],
+  age: 21
+}, {
+  name: 'Bob',
+  books: ['War and peace', 'Romeo and Juliet'],
+  age: 26
+}, {
+  name: 'Alice',
+  books: ['The Lord of the Rings', 'The Shining'],
+  age: 18
+}];
+
+// allbooks - list which will contain all friends' books +
+// additional list contained in initialValue
+var allbooks = friends.reduce(function(prev, curr) {
+ return [...prev, ...curr.books];
+}, ['Alphabet']);
+
+// allbooks = [
+// 'Alphabet', 'Bible', 'Harry Potter', 'War and peace',
+// 'Romeo and Juliet', 'The Lord of the Rings',
+// 'The Shining'
+// ]</pre>
+
+<p> </p>
+
+<h3 id="移除陣列中的重複項目">移除陣列中的重複項目</h3>
+
+<pre class="brush: js">let arr = [1, 2, 1, 2, 3, 5, 4, 5, 3, 4, 4, 4, 4];
+let result = arr.sort().reduce((init, current) =&gt; {
+ if (init.length === 0 || init[init.length - 1] !== current) {
+ init.push(current);
+ }
+ return init;
+}, []);
+console.log(result); //[1,2,3,4,5]
+</pre>
+
+<h3 id="序列執行_Promise">序列執行 Promise</h3>
+
+<pre class="brush: js">/**
+ * Runs promises from promise array in chained manner
+ *
+ * @param {array} arr - promise arr
+ * @return {Object} promise object
+ */
+function runPromiseInSequense(arr) {
+ return arr.reduce((promiseChain, currentPromise) =&gt; {
+ return promiseChain.then((chainedResult) =&gt; {
+ return currentPromise(chainedResult)
+ .then((res) =&gt; res)
+ })
+ }, Promise.resolve());
+}
+
+// promise function 1
+function p1() {
+ return new Promise((resolve, reject) =&gt; {
+ resolve(5);
+ });
+}
+
+// promise function 2
+function p2(a) {
+ return new Promise((resolve, reject) =&gt; {
+ resolve(a * 2);
+ });
+}
+
+// promise function 3
+function p3(a) {
+ return new Promise((resolve, reject) =&gt; {
+ resolve(a * 3);
+ });
+}
+
+const promiseArr = [p1, p2, p3];
+runPromiseInSequense(promiseArr)
+ .then((res) =&gt; {
+ console.log(res); // 30
+ });
+
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.21
+// Reference: http://es5.github.io/#x15.4.4.21
+// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
+if (!Array.prototype.reduce) {
+ Object.defineProperty(Array.prototype, 'reduce', {
+ value: function(callback /*, initialValue*/) {
+ if (this === null) {
+ throw new TypeError( 'Array.prototype.reduce ' +
+ 'called on null or undefined' );
+ }
+ if (typeof callback !== 'function') {
+ throw new TypeError( callback +
+  ' is not a function');
+ }
+
+ // 1. Let O be ? ToObject(this value).
+ var o = Object(this);
+
+ // 2. Let len be ? ToLength(? Get(O, "length")).
+ var len = o.length &gt;&gt;&gt; 0;
+
+ // Steps 3, 4, 5, 6, 7
+ var k = 0;
+ var value;
+
+ if (arguments.length &gt;= 2) {
+ value = arguments[1];
+ } else {
+ while (k &lt; len &amp;&amp; !(k in o)) {
+ k++;
+ }
+
+ // 3. If len is 0 and initialValue is not present,
+  // throw a TypeError exception.
+ if (k &gt;= len) {
+ throw new TypeError( 'Reduce of empty array ' +
+  'with no initial value' );
+ }
+ value = o[k++];
+ }
+
+ // 8. Repeat, while k &lt; len
+ while (k &lt; len) {
+ // a. Let Pk be ! ToString(k).
+ // b. Let kPresent be ? HasProperty(O, Pk).
+ // c. If kPresent is true, then
+ // i. Let kValue be ? Get(O, Pk).
+ // ii. Let accumulator be ? Call(
+  // callbackfn, undefined,
+   // « accumulator, kValue, k, O »).
+ if (k in o) {
+ value = callback(value, o[k], k, o);
+ }
+
+ // d. Increase k by 1.
+ k++;
+ }
+
+ // 9. Return accumulator.
+ return value;
+ }
+ });
+}
+</pre>
+
+<p>如果還需要支援老舊到不支援 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty">Object.defineProperty</a></code> 的 JavaScript 引擎,最好不要 polyfill <code>Array.prototype</code> 方法,因為你無法令其不可枚舉(non-enumerable)。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.21', 'Array.prototype.reduce()')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.reduce', 'Array.prototype.reduce()')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.reduce', 'Array.prototype.reduce()')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.reduce")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.reduceRight()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html
new file mode 100644
index 0000000000..d3104c28be
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/reverse/index.html
@@ -0,0 +1,90 @@
+---
+title: Array.prototype.reverse()
+slug: Web/JavaScript/Reference/Global_Objects/Array/reverse
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/reverse
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>reverse()</strong></code> 方法會<em><a href="https://zh.wikipedia.org/wiki/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地(in place)</a></em>反轉(reverses)一個陣列。陣列中的第一個元素變為最後一個,而最後一個元素則變成第一個。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-reverse.html")}}</div>
+
+
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<pre class="syntaxbox"><var>a</var>.reverse()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>反轉後的陣列。</p>
+
+<h2 id="Description" name="Description">描述</h2>
+
+<p><code>reverse</code> 方法將原地(in place)變換(transposes)呼叫此方法的陣列物件之元素至其顛倒的位置,改變原陣列後,並回傳此陣列之參考位址(reference)。</p>
+
+<h2 id="Examples" name="Examples">範例</h2>
+
+<h3 id="Example:_Reversing_the_elements_in_an_array" name="Example:_Reversing_the_elements_in_an_array">反轉陣列中之元素</h3>
+
+<p>下列範例建立了一個包含三個元素的陣列 <code>a</code>,接著反轉此陣列。呼叫 <code>reverse()</code> 會回傳一個反轉後的原陣列 <code>a</code> 之參考。</p>
+
+<pre class="brush: js">var a = ['one', 'two', 'three'];
+var reversed = a.reverse();
+
+console.log(a); // ['three', 'two', 'one']
+console.log(reversed); // ['three', 'two', 'one']
+</pre>
+
+<h2 id="Specifications" name="Specifications">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.8', 'Array.prototype.reverse')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.reverse', 'Array.prototype.reverse')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.reverse', 'Array.prototype.reverse')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.reverse")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.join()")}}</li>
+ <li>{{jsxref("Array.prototype.sort()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.reverse()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/shift/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/shift/index.html
new file mode 100644
index 0000000000..269dfac4fe
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/shift/index.html
@@ -0,0 +1,114 @@
+---
+title: Array.prototype.shift()
+slug: Web/JavaScript/Reference/Global_Objects/Array/shift
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - shift
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/shift
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>shift()</strong></code> 方法會移除並回傳陣列的<strong>第一個</strong>元素。此方法會改變陣列的長度。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-shift.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.shift()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>自陣列中移除的元素;若陣列為空,則為 {{jsxref("undefined")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>shift</code> 方法會移除並回傳陣列中索引值為零之元素(即第一個元素),並將隨後的其他索引值減一。假如 {{jsxref("Array.length", "length")}} 屬性值為 0,則會回傳 {{jsxref("undefined")}}。</p>
+
+<p><code>shift</code> 方法被刻意設計為具通用性;此方法可以藉由 {{jsxref("Function.call", "called", "", 1)}} 或 {{jsxref("Function.apply", "applied", "", 1)}} 應用於類似陣列的物件上。若欲應用此方法的物件不包含代表一系列啟始為零之數字屬性序列長度的 <code>length</code> 屬性,可能是不具任何意義的行為。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="自陣列中移除一個元素">自陣列中移除一個元素</h3>
+
+<p>以下的程式碼會印出 <code>myFish</code> 陣列在移除第一個元素之前跟之後的內容,也印出了被移除的元素:</p>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];
+
+console.log('myFish before:', JSON.stringify(myFish));
+// myFish before: ['angel', 'clown', 'mandarin', 'surgeon']
+
+var shifted = myFish.shift();
+
+console.log('myFish after:', myFish);
+// myFish after: ['clown', 'mandarin', 'surgeon']
+
+console.log('Removed this element:', shifted);
+// Removed this element: angel
+</pre>
+
+<h3 id="於_while_迴圈中使用_shift()_方法">於 while 迴圈中使用 shift() 方法</h3>
+
+<p><code>shift()</code> 方法常被用在 while 迴圈中的條件判斷。在下面的例子,每一次迭代都將會自陣列中移除下一個元素,直到陣列空了為止:</p>
+
+<pre class="brush: js">var names = ["Andrew", "Edward", "Paul", "Chris" ,"John"];
+
+while( (i = names.shift()) !== undefined ) {
+    console.log(i);
+}
+// Andrew, Edward, Paul, Chris, John
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.9', 'Array.prototype.shift')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.shift', 'Array.prototype.shift')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.shift', 'Array.prototype.shift')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.shift")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.push()")}}</li>
+ <li>{{jsxref("Array.prototype.pop()")}}</li>
+ <li>{{jsxref("Array.prototype.unshift()")}}</li>
+ <li>{{jsxref("Array.prototype.concat()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html
new file mode 100644
index 0000000000..e9cb1fb02c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/slice/index.html
@@ -0,0 +1,242 @@
+---
+title: Array.prototype.slice()
+slug: Web/JavaScript/Reference/Global_Objects/Array/slice
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/slice
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>slice()</strong></code> 方法會回傳一個新陣列物件,為原陣列選擇之 <code>begin</code> 至 <code>end</code>(不含 <code>end</code>)部分的淺拷貝(shallow copy)。而原本的陣列將不會被修改。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-slice.html")}}</div>
+
+<p class="hidden">The source for this interactive demo is stored in a GitHub repository. If you'd like to contribute to the interactive demo project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate"><var>arr</var>.slice(<em>[</em><var>begin[</var>, <var>end]]</var>)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>begin</code> {{optional_inline}}</dt>
+ <dd>自哪一個索引(起始為 0)開始提取拷貝。</dd>
+ <dd>可使用負數索引,表示由陣列的最末項開始提取。<code>slice(-2)</code> 代表拷貝陣列中的最後兩個元素。</dd>
+ <dd>假如 <code>begin</code> 為 undefined,則 <code>slice</code> 會從索引 <code>0</code> 開始提取。</dd>
+ <dt><code>end</code> {{optional_inline}}</dt>
+ <dd>至哪一個索引(起始為 0)<em>之前</em>停止提取。<code>slice</code> 提取但不包含至索引 <code>end</code>。</dd>
+ <dd>舉例來說,<code>slice(1,4)</code> 提取了陣列中第二個元素至第四個元素前為止(元素索引 1、2 以及 3)來拷貝。</dd>
+ <dd>可使用負數索引,表示由陣列的最末項開始提取。<code>slice(2,-1)</code> 代表拷貝陣列中第三個元素至倒數第二個元素。</dd>
+ <dd>若省略了 <code>end</code>,則 <code>slice</code> 會提取至陣列的最後一個元素(<code>arr.length</code>)。</dd>
+ <dd>假如 <code>end</code> 大於陣列的長度,<code>slice</code> 會提取至陣列的最後一個元素(<code>arr.length</code>)。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個包含提取之元素的新陣列。</p>
+
+<h2 id="說明">說明</h2>
+
+<p><code>slice</code> 不會修改原本的陣列,而是回傳由原本的陣列淺層複製的元素。原始陣列的元素會按照下列規則拷貝:</p>
+
+<ul>
+ <li>如果該元素是個對象引用(不是實際的對象),<code>slice</code> 會拷貝這個對象引用到新的陣列內。兩個對象引用都引用了同一個對象。如果被引用的對象發生改變,則新的和原來的陣列中的這個元素也會發生改變。</li>
+ <li>對於字串、數字、布林來說 (不是 <a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/String"><code>String</code></a>、<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Number"><code>Number</code></a> 或者 <a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Boolean"><code>Boolean</code></a> 對象), <code>slice</code> 會拷貝這些值到新的陣列內。在別的陣列內修改這些字串、數字或是布林,將不會影響另一個陣列。</li>
+</ul>
+
+<p>如果添加了新的元素到另一個陣列內,則另一個不會受到影響。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Return_a_portion_of_an_existing_array">Return a portion of an existing array</h3>
+
+<pre class="brush: js notranslate">var fruits = ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango'];
+var citrus = fruits.slice(1, 3);
+
+// fruits contains ['Banana', 'Orange', 'Lemon', 'Apple', 'Mango']
+// citrus contains ['Orange','Lemon']
+</pre>
+
+<h3 id="Using_slice">Using <code>slice</code></h3>
+
+<p>In the following example, <code>slice</code> creates a new array, <code>newCar</code>, from <code>myCar</code>. Both include a reference to the object <code>myHonda</code>. When the color of <code>myHonda</code> is changed to purple, both arrays reflect the change.</p>
+
+<pre class="brush: js notranslate">// Using slice, create newCar from myCar.
+var myHonda = { color: 'red', wheels: 4, engine: { cylinders: 4, size: 2.2 } };
+var myCar = [myHonda, 2, 'cherry condition', 'purchased 1997'];
+var newCar = myCar.slice(0, 2);
+
+// Display the values of myCar, newCar, and the color of myHonda
+// referenced from both arrays.
+console.log('myCar = ' + JSON.stringify(myCar));
+console.log('newCar = ' + JSON.stringify(newCar));
+console.log('myCar[0].color = ' + myCar[0].color);
+console.log('newCar[0].color = ' + newCar[0].color);
+
+// Change the color of myHonda.
+myHonda.color = 'purple';
+console.log('The new color of my Honda is ' + myHonda.color);
+
+// Display the color of myHonda referenced from both arrays.
+console.log('myCar[0].color = ' + myCar[0].color);
+console.log('newCar[0].color = ' + newCar[0].color);
+</pre>
+
+<p>This script writes:</p>
+
+<pre class="brush: js notranslate">myCar = [{color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}}, 2,
+ 'cherry condition', 'purchased 1997']
+newCar = [{color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}}, 2]
+myCar[0].color = red
+newCar[0].color = red
+The new color of my Honda is purple
+myCar[0].color = purple
+newCar[0].color = purple
+</pre>
+
+<h2 id="類陣例(Array-like)物件">類陣例(Array-like)物件</h2>
+
+<p><code>slice</code> method can also be called to convert Array-like objects / collections to a new Array. You just bind the method to the object. The {{jsxref("Functions/arguments", "arguments")}} inside a function is an example of an 'array-like object'.</p>
+
+<pre class="brush: js notranslate">function list() {
+ return Array.prototype.slice.call(arguments);
+}
+
+var list1 = list(1, 2, 3); // [1, 2, 3]
+</pre>
+
+<p>Binding can be done with the .<code>call</code> function of {{jsxref("Function.prototype")}} and it can also be reduced using <code>[].slice.call(arguments)</code> instead of <code>Array.prototype.slice.call</code>. Anyway, it can be simplified using {{jsxref("Function.prototype.bind", "bind")}}.</p>
+
+<pre class="brush: js notranslate">var unboundSlice = Array.prototype.slice;
+var slice = Function.prototype.call.bind(unboundSlice);
+
+function list() {
+ return slice(arguments);
+}
+
+var list1 = list(1, 2, 3); // [1, 2, 3]
+</pre>
+
+<h2 id="Streamlining_cross-browser_behavior">Streamlining cross-browser behavior</h2>
+
+<p>Although host objects (such as DOM objects) are not required by spec to follow the Mozilla behavior when converted by <code>Array.prototype.slice</code> and IE &lt; 9 does not do so, versions of IE starting with version 9 do allow this. “Shimming” it can allow reliable cross-browser behavior. As long as other modern browsers continue to support this ability, as currently do IE, Mozilla, Chrome, Safari, and Opera, developers reading (DOM-supporting) slice code relying on this shim will not be misled by the semantics; they can safely rely on the semantics to provide the now apparently <em>de facto</em> standard behavior. (The shim also fixes IE to work with the second argument of <code>slice()</code> being an explicit {{jsxref("null")}}/{{jsxref("undefined")}} value as earlier versions of IE also did not allow but all modern browsers, including IE &gt;= 9, now do.)</p>
+
+<pre class="brush: js notranslate">/**
+ * Shim for "fixing" IE's lack of support (IE &lt; 9) for applying slice
+ * on host objects like NamedNodeMap, NodeList, and HTMLCollection
+ * (technically, since host objects have been implementation-dependent,
+ * at least before ES2015, IE hasn't needed to work this way).
+ * Also works on strings, fixes IE &lt; 9 to allow an explicit undefined
+ * for the 2nd argument (as in Firefox), and prevents errors when
+ * called on other DOM objects.
+ */
+(function () {
+ 'use strict';
+ var _slice = Array.prototype.slice;
+
+ try {
+ // Can't be used with DOM elements in IE &lt; 9
+ _slice.call(document.documentElement);
+ } catch (e) { // Fails in IE &lt; 9
+ // This will work for genuine arrays, array-like objects,
+ // NamedNodeMap (attributes, entities, notations),
+ // NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes),
+ // and will not fail on other DOM objects (as do DOM elements in IE &lt; 9)
+ Array.prototype.slice = function(begin, end) {
+ // IE &lt; 9 gets unhappy with an undefined end argument
+ end = (typeof end !== 'undefined') ? end : this.length;
+
+ // For native Array objects, we use the native slice function
+ if (Object.prototype.toString.call(this) === '[object Array]'){
+ return _slice.call(this, begin, end);
+ }
+
+ // For array like object we handle it ourselves.
+ var i, cloned = [],
+ size, len = this.length;
+
+ // Handle negative value for "begin"
+ var start = begin || 0;
+ start = (start &gt;= 0) ? start : Math.max(0, len + start);
+
+ // Handle negative value for "end"
+ var upTo = (typeof end == 'number') ? Math.min(end, len) : len;
+ if (end &lt; 0) {
+ upTo = len + end;
+ }
+
+ // Actual expected size of the slice
+ size = upTo - start;
+
+ if (size &gt; 0) {
+ cloned = new Array(size);
+ if (this.charAt) {
+ for (i = 0; i &lt; size; i++) {
+ cloned[i] = this.charAt(start + i);
+ }
+ } else {
+ for (i = 0; i &lt; size; i++) {
+ cloned[i] = this[start + i];
+ }
+ }
+ }
+
+ return cloned;
+ };
+ }
+}());
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.10', 'Array.prototype.slice')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.slice', 'Array.prototype.slice')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.slice', 'Array.prototype.slice')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.slice")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.splice()")}}</li>
+ <li>{{jsxref("Function.prototype.call()")}}</li>
+ <li>{{jsxref("Function.prototype.bind()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html
new file mode 100644
index 0000000000..7dd0fbdf34
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/some/index.html
@@ -0,0 +1,217 @@
+---
+title: Array.prototype.some()
+slug: Web/JavaScript/Reference/Global_Objects/Array/some
+tags:
+ - Array
+ - ECMAScript5
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/some
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>some()</strong></code> 方法會透過給定函式、測試陣列中是否至少有一個元素,通過該函式所實作的測試。這方法回傳的是布林值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-some.html")}}</div>
+
+<div class="note">
+<p><strong>注意</strong>:如果輸入空陣列的話,這個方法會回傳 <code>false</code>。</p>
+</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.some(<var>callback</var>[, <var>thisArg</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>callback</code></dt>
+ <dd>用來測試每一個元素的函式,它包含三個引數:
+ <dl>
+ <dt><code>currentValue</code></dt>
+ <dd>目前正要被處理的陣列元素。</dd>
+ <dt><code>index{{Optional_inline}}</code></dt>
+ <dd>目前正要被處理的陣列元素之索引值。</dd>
+ <dt><code>array{{Optional_inline}}</code></dt>
+ <dd>呼叫 <code>some()</code> 的陣列。</dd>
+ </dl>
+ </dd>
+ <dt><code>thisArg{{Optional_inline}}</code></dt>
+ <dd>執行 <code>callback</code> 回呼函式的 <code>this</code> 值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>若回呼函式在處理任何一個陣列元素時得到 {{Glossary("truthy")}} 值,則回傳 <code><strong>true</strong></code>。否則,回傳值為 <code><strong>false</strong></code>。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>The <code>some()</code> method executes the <code>callback</code> function once for each element present in the array until it finds the one where <code>callback</code> returns a <em>truthy</em> value (a value that becomes true when converted to a Boolean). If such an element is found, <code>some()</code> immediately returns <code>true</code>. Otherwise, <code>some()</code> returns <code>false</code>. <code>callback</code> is invoked only for indexes of the array with assigned values. It is not invoked for indexes which have been deleted or which have never been assigned values.</p>
+
+<p><code>callback</code> is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.</p>
+
+<p>If a <code>thisArg</code> parameter is provided to <code>some()</code>, it will be used as the callback's <code>this</code> value. Otherwise, the value {{jsxref("undefined")}} will be used as its <code>this</code> value. The <code>this</code> value ultimately observable by <code>callback</code> is determined according to <a href="/en-US/docs/Web/JavaScript/Reference/Operators/this">the usual rules for determining the <code>this</code> seen by a function</a>.</p>
+
+<p><code>some()</code> does not mutate the array on which it is called.</p>
+
+<p>The range of elements processed by <code>some()</code> is set before the first invocation of <code>callback</code>. Elements appended to the array after the call to <code>some()</code> begins will not be visited by <code>callback</code>. If an existing, unvisited element of the array is changed by <code>callback</code>, its value passed to the visiting <code>callback</code> will be the value at the time that <code>some()</code> visits that element's index. Elements that are deleted are not visited.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="測試陣列元素的數值">測試陣列元素的數值</h3>
+
+<p>以下範例將測試是否最少有一個元素的數值大於 10。</p>
+
+<pre class="brush: js">function isBiggerThan10(element, index, array) {
+ return element &gt; 10;
+}
+
+[2, 5, 8, 1, 4].some(isBiggerThan10); // false
+[12, 5, 8, 1, 4].some(isBiggerThan10); // true</pre>
+
+<p>{{ EmbedLiveSample('Testing_value_of_array_elements', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p>
+
+<h3 id="使用箭頭函式測試">使用箭頭函式測試</h3>
+
+<p><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭頭函式</a>能給相同的測試,提供更簡潔的語法。</p>
+
+<pre class="brush: js">[2, 5, 8, 1, 4].some(x =&gt; x &gt; 10); //false
+[12, 5, 8, 1, 4].some(x =&gt; x &gt; 10); // true</pre>
+
+<p>{{ EmbedLiveSample('Testing_array_elements_using_arrow_functions', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p>
+
+<h3 id="測試陣列元素的數值是否存在">測試陣列元素的數值是否存在</h3>
+
+<p>To mimic the function of the <code>includes()</code> method, this custom function returns <code>true</code> if the element exists in the array:</p>
+
+<pre class="brush: js">const fruits = ['apple', 'banana', 'mango', 'guava'];
+
+function checkAvailability(arr, val) {
+ return arr.some(function(arrVal) {
+ return val === arrVal;
+ });
+}
+
+checkAvailability(fruits, 'kela'); // false
+checkAvailability(fruits, 'banana'); // true</pre>
+
+<p>{{ EmbedLiveSample('Checking_whether_a_value_exists_in_an_array', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p>
+
+<h3 id="Checking_whether_a_value_exists_using_an_arrow_function">Checking whether a value exists using an arrow function</h3>
+
+<pre class="brush: js">const fruits = ['apple', 'banana', 'mango', 'guava'];
+
+function checkAvailability(arr, val) {
+ return arr.some(arrVal =&gt; val === arrVal);
+}
+
+checkAvailability(fruits, 'kela'); // false
+checkAvailability(fruits, 'banana'); // true</pre>
+
+<p>{{ EmbedLiveSample('Checking_whether_a_value_exists_using_an_arrow_function', '', '', '', 'Experiment:StaticExamplesOnTop/JavaScript/Array/some') }}</p>
+
+<h3 id="Converting_any_value_to_Boolean">Converting any value to Boolean</h3>
+
+<pre class="brush: js">const TRUTHY_VALUES = [true, 'true', 1];
+
+function getBoolean(value) {
+ 'use strict';
+
+ if (typeof value === 'string') {
+ value = value.toLowerCase().trim();
+ }
+
+ return TRUTHY_VALUES.some(function(t) {
+ return t === value;
+ });
+}
+
+getBoolean(false); // false
+getBoolean('false'); // false
+getBoolean(1); // true
+getBoolean('true'); // true</pre>
+
+<p>{{ EmbedLiveSample('Converting_any_value_to_Boolean', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p><code>some()</code> was added to the ECMA-262 standard in the 5th edition, and it may not be present in all implementations of the standard. You can work around this by inserting the following code at the beginning of your scripts, allowing use of <code>some()</code> in implementations which do not natively support it. This algorithm is exactly the one specified in ECMA-262, 5th edition, assuming {{jsxref("Object")}} and {{jsxref("TypeError")}} have their original values and that <code>fun.call</code> evaluates to the original value of {{jsxref("Function.prototype.call()")}}.</p>
+
+<pre class="brush: js">// Production steps of ECMA-262, Edition 5, 15.4.4.17
+// Reference: http://es5.github.io/#x15.4.4.17
+if (!Array.prototype.some) {
+ Array.prototype.some = function(fun, thisArg) {
+ 'use strict';
+
+ if (this == null) {
+ throw new TypeError('Array.prototype.some called on null or undefined');
+ }
+
+ if (typeof fun !== 'function') {
+ throw new TypeError();
+ }
+
+ var t = Object(this);
+ var len = t.length &gt;&gt;&gt; 0;
+
+ for (var i = 0; i &lt; len; i++) {
+ if (i in t &amp;&amp; fun.call(thisArg, t[i], i, t)) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+}
+</pre>
+
+<p>{{ EmbedLiveSample('Polyfill', '', '', '', 'Web/JavaScript/Reference/Global_Objects/Array/some') }}</p>
+
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.17', 'Array.prototype.some')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初始定義。在 JavaScript 1.6 實作。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.some', 'Array.prototype.some')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.some', 'Array.prototype.some')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.some")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.find()")}}</li>
+ <li>{{jsxref("TypedArray.prototype.some()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html
new file mode 100644
index 0000000000..7240184a75
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/sort/index.html
@@ -0,0 +1,248 @@
+---
+title: Array.prototype.sort()
+slug: Web/JavaScript/Reference/Global_Objects/Array/sort
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/sort
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>sort()</strong></code> 方法會<em><a href="https://zh.wikipedia.org/wiki/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地(in place)</a></em>對一個陣列的所有元素進行排序,並回傳此陣列。排序不一定是<a href="https://zh.wikipedia.org/wiki/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95#%E7%A9%A9%E5%AE%9A%E6%80%A7">穩定的(stable)</a>。預設的排序順序是根據字串的 Unicode 編碼位置(code points)而定。</p>
+
+<p>由於依賴執行環境的實作,所以並不能保證排序的時間及空間複雜度。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-sort.html")}}</div>
+
+
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.sort(<var>[compareFunction]</var>)
+</pre>
+
+<h3 id="Parameters" name="Parameters">參數</h3>
+
+<dl>
+ <dt><code>compareFunction</code> {{optional_inline}}</dt>
+ <dd>指定一個函式來定義排序順序。假如省略此參數,陣列將根據各個元素轉為字串後的每一個字元之 <a href="/zh-TW/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#Unicode">Unicode</a> 編碼位置值進行排序。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>排序後的陣列。請注意此為<em><a href="https://zh.wikipedia.org/wiki/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95">原地(in place)</a></em>進行排序過的陣列,並且不是原陣列的拷貝。</p>
+
+<h2 id="Description" name="Description">描述</h2>
+
+<p>如果 <code>compareFunction</code> 沒有被應用,元素將被轉換為字串並以 Unicode 編碼位置進行比較來排序。舉例來說,"Banana" 會被排在 "cherry" 之前。在數值排序中,9 排在 80 前面,但因為數字被轉換成字串,在 Unicode 順序中 "80" 會在 "9" 的前面。</p>
+
+<p>如果 <code>compareFunction</code> 被應用,陣列元素們將根據比較函式之回傳值來排序。如果 <code>a</code> 和 <code>b</code> 為被比較之兩元素,則:</p>
+
+<ul>
+ <li>若 <code>compareFunction(a, b)</code> 的回傳值小於 0,則會把 <code>a</code> 排在小於 <code>b</code> 之索引的位置,即 <code>a</code> 排在 <code>b</code> 前面。</li>
+ <li>若 <code>compareFunction(a, b)</code> 回傳 0,則 <code>a</code> 與 <code>b</code> 皆不會改變彼此的順序,但會與其他全部的元素比較來排序。備註:ECMAscript 標準並不保證這個行為,因此不是所有瀏覽器(如 Mozilla 版本在 2003 以前)都遵守此行為。</li>
+ <li>若 <code>compareFunction(a, b)</code> 的回傳值大於 0,則會把 <code>b</code> 排在小於 <code>a</code> 之索引的位置,即 <code>b</code> 排在 <code>a</code> 前面。</li>
+ <li><code>compareFunction(a, b)</code> 在給予一組特定元素 a 及 b 為此函數之兩引數時必須總是回傳相同的值。若回傳值不一致,排序順序則為 undefined。</li>
+</ul>
+
+<p>所以,比較函式會是以下形式:</p>
+
+<pre class="brush: js">function compare(a, b) {
+ if (在某排序標準下 a 小於 b) {
+ return -1;
+ }
+ if (在某排序標準下 a 大於 b) {
+ return 1;
+ }
+ // a 必須等於 b
+ return 0;
+}
+</pre>
+
+<p>為了比較數字而不是字串,比較函式可以僅僅利用 <code>a</code> 減 <code>b</code>。以下函式將會升冪排序陣列:</p>
+
+<pre class="brush: js">function compareNumbers(a, b) {
+ return a - b;
+}
+</pre>
+
+<p><code>sort</code> 方法可以直接使用{{jsxref("Operators/function", "函式運算式", "", 1)}}(以及<a href="/zh-TW/docs/Web/JavaScript/Guide/Closures">閉包(closures)</a>):</p>
+
+<pre class="brush: js">var numbers = [4, 2, 5, 1, 3];
+numbers.sort(function(a, b) {
+ return a - b;
+});
+console.log(numbers);
+
+// [1, 2, 3, 4, 5]
+</pre>
+
+<p>物件可以按照其中一個屬性的值來排序。</p>
+
+<pre class="brush: js">var items = [
+ { name: 'Edward', value: 21 },
+ { name: 'Sharpe', value: 37 },
+ { name: 'And', value: 45 },
+ { name: 'The', value: -12 },
+ { name: 'Magnetic', value: 13 },
+ { name: 'Zeros', value: 37 }
+];
+
+// sort by value
+items.sort(function (a, b) {
+ return a.value - b.value;
+});
+
+// sort by name
+items.sort(function(a, b) {
+ var nameA = a.name.toUpperCase(); // ignore upper and lowercase
+ var nameB = b.name.toUpperCase(); // ignore upper and lowercase
+  if (nameA &lt; nameB) {
+ return -1;
+  }
+  if (nameA &gt; nameB) {
+ return 1;
+  }
+
+  // names must be equal
+  return 0;
+});</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Example:_Creating.2C_displaying.2C_and_sorting_an_array" name="Example:_Creating.2C_displaying.2C_and_sorting_an_array">建立、顯示及排序一個陣列</h3>
+
+<p>下列範例建立了四個陣列並顯示其原本陣列內容、再進行排序。數字陣列先不使用比較函式(compare function)來排序,接著才依據比較函式進行排序。</p>
+
+<pre class="brush: js">var stringArray = ['Blue', 'Humpback', 'Beluga'];
+var numericStringArray = ['80', '9', '700'];
+var numberArray = [40, 1, 5, 200];
+var mixedNumericArray = ['80', '9', '700', 40, 1, 5, 200];
+
+function compareNumbers(a, b) {
+ return a - b;
+}
+
+console.log('stringArray:', stringArray.join());
+console.log('Sorted:', stringArray.sort());
+
+console.log('numberArray:', numberArray.join());
+console.log('Sorted without a compare function:', numberArray.sort());
+console.log('Sorted with compareNumbers:', numberArray.sort(compareNumbers));
+
+console.log('numericStringArray:', numericStringArray.join());
+console.log('Sorted without a compare function:', numericStringArray.sort());
+console.log('Sorted with compareNumbers:', numericStringArray.sort(compareNumbers));
+
+console.log('mixedNumericArray:', mixedNumericArray.join());
+console.log('Sorted without a compare function:', mixedNumericArray.sort());
+console.log('Sorted with compareNumbers:', mixedNumericArray.sort(compareNumbers));
+</pre>
+
+<p>這個範例將產生下列結果。就如結果所示,當使用比較函式時,數字會被正確的排序,不管是數字還是數字字串。</p>
+
+<pre>stringArray: Blue,Humpback,Beluga
+Sorted: Beluga,Blue,Humpback
+
+numberArray: 40,1,5,200
+Sorted without a compare function: 1,200,40,5
+Sorted with compareNumbers: 1,5,40,200
+
+numericStringArray: 80,9,700
+Sorted without a compare function: 700,80,9
+Sorted with compareNumbers: 9,80,700
+
+mixedNumericArray: 80,9,700,40,1,5,200
+Sorted without a compare function: 1,200,40,5,700,80,9
+Sorted with compareNumbers: 1,5,9,40,80,200,700
+</pre>
+
+<h3 id="Example:_Sorting_non-ASCII_characters" name="Example:_Sorting_non-ASCII_characters">排序非 ASCII 字元</h3>
+
+<p>為了排列非 ASCII 字元,即重音節字元(e、é、è、a、ä 等等),非英語字串:利用 {{jsxref("String.localeCompare")}}。此函式將比較這些字元,所以結果將會顯示正確的順序。</p>
+
+<pre class="brush: js">var items = ['réservé', 'premier', 'cliché', 'communiqué', 'café', 'adieu'];
+items.sort(function (a, b) {
+ return a.localeCompare(b);
+});
+
+// items is ['adieu', 'café', 'cliché', 'communiqué', 'premier', 'réservé']
+</pre>
+
+<h3 id="Example:_Sorting_maps" name="Example:_Sorting_maps">排序 map</h3>
+
+<p><code>compareFunction</code> 可以被陣列中的各個元素多次呼叫。依據 <code>compareFunction</code> 的特性,這將會產生大量運算。越多元素要排序 <code>compareFunction</code> 就越多工作要做,因此選擇使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Array/map">map</a> 來排列也就是一個更明智的選擇。作法為先迭代陣列一次來取得排序時所需的值至暫時的陣列,並對此臨時陣列進行排序。然後再迭代臨時陣列來將正確順序之值放入原始陣列中。</p>
+
+<pre class="brush: js" dir="rtl">// the array to be sorted
+var list = ['Delta', 'alpha', 'CHARLIE', 'bravo'];
+
+// temporary array holds objects with position and sort-value
+var mapped = list.map(function(el, i) {
+ return { index: i, value: el.toLowerCase() };
+})
+
+// sorting the mapped array containing the reduced values
+mapped.sort(function(a, b) {
+ if (a.value &gt; b.value) {
+ return 1;
+ }
+ if (a.value &lt; b.value) {
+ return -1;
+ }
+ return 0;
+});
+
+// container for the resulting order
+var result = mapped.map(function(el){
+ return list[el.index];
+});
+</pre>
+
+<h2 id="Specifications" name="Specifications">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.11', 'Array.prototype.sort')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.sort', 'Array.prototype.sort')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.sort', 'Array.prototype.sort')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.sort")}}</p>
+</div>
+
+<h2 id="See_also" name="See_also">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.reverse()")}}</li>
+ <li>{{jsxref("String.prototype.localeCompare()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html
new file mode 100644
index 0000000000..2cb76617b8
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/splice/index.html
@@ -0,0 +1,150 @@
+---
+title: Array.prototype.splice()
+slug: Web/JavaScript/Reference/Global_Objects/Array/splice
+tags:
+ - Array
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/splice
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>splice()</strong></code> 方法可以藉由刪除既有元素並/或加入新元素來改變一個陣列的內容。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-splice.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>array</var>.splice(<var>start[</var>, <var>deleteCount[</var>, <var>item1[</var>, <var>item2[</var>, <em>...]]]]</em>)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>start</code></dt>
+ <dd>陣列中要開始改動的元素索引(起始為 0)。若索引大於陣列長度,則實際開始的索引值會被設為陣列長度。若索引為負,則會從陣列中最後一個元素開始往前改動(起始為 -1)且若其絕對值大於陣列的長度,則會被設為 0。</dd>
+ <dt><code>deleteCount</code> {{optional_inline}}</dt>
+ <dd>一個表示欲刪除的原陣列元素數量的整數。</dd>
+ <dd>若省略了 <code>deleteCount</code>,或假如其值大於 <code>array.length - start</code>(也就是 <code>deleteCount</code> 大於 <code>start</code> 算起的剩餘元素數量),則所有從 <code>start</code> 開始到陣列中最後一個元素都會被刪除。</dd>
+ <dd>若 <code>deleteCount</code> 為 0 或是負數,則不會有元素被刪除。 因此,你應該給定至少一個欲加入的新元素(見下方說明)。</dd>
+ <dt><code>item1, item2, <em>...</em></code> {{optional_inline}}</dt>
+ <dd>從 <code>start</code> 開始,要加入到陣列的元素。 如果你沒有指定任何元素,則 <code>splice()</code> 只會依照 <code>start</code> 和 <code>deleteCount</code> 刪除陣列的元素。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個包含被刪除的元素陣列。如果只有一個元素被刪除,依舊是回傳包含一個元素的陣列。 倘若沒有元素被刪除,則會回傳空陣列。</p>
+
+<h2 id="說明">說明</h2>
+
+<p>如果你插入的元素數量和刪除的數量不同,則回傳的陣列長度也會和原先的不同。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="從索引_2_的位置開始,刪除_0_個元素並插入「drum」">從索引 2 的位置開始,刪除 0 個元素並插入「drum」</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
+var removed = myFish.splice(2, 0, 'drum');
+
+// myFish 為 ["angel", "clown", "drum", "mandarin", "sturgeon"]
+// removed 為 [], 沒有元素被刪除
+</pre>
+
+<h3 id="從索引_3_的位置開始,刪除_1_個元素">從索引 3 的位置開始,刪除 1 個元素</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'drum', 'mandarin', 'sturgeon'];
+var removed = myFish.splice(3, 1);
+
+// removed 為 ["mandarin"]
+// myFish 為 ["angel", "clown", "drum", "sturgeon"]
+</pre>
+
+<h3 id="從索引_2_的位置開始,刪除_1_個元素並插入「trumpet」">從索引 2 的位置開始,刪除 1 個元素並插入「trumpet」</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'drum', 'sturgeon'];
+var removed = myFish.splice(2, 1, 'trumpet');
+
+// myFish 為 ["angel", "clown", "trumpet", "sturgeon"]
+// removed 為 ["drum"]</pre>
+
+<h3 id="從索引_0_的位置開始,刪除_2_個元素並插入「parrot」、「anemone」和「blue」">從索引 0 的位置開始,刪除 2 個元素並插入「parrot」、「anemone」和「blue」</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'trumpet', 'sturgeon'];
+var removed = myFish.splice(0, 2, 'parrot', 'anemone', 'blue');
+
+// myFish 為 ["parrot", "anemone", "blue", "trumpet", "sturgeon"]
+// removed 為 ["angel", "clown"]</pre>
+
+<h3 id="從索引_2_的位置開始,刪除_2_個元素">從索引 2 的位置開始,刪除 2 個元素</h3>
+
+<pre class="brush: js">var myFish = ['parrot', 'anemone', 'blue', 'trumpet', 'sturgeon'];
+var removed = myFish.splice(myFish.length - 3, 2);
+
+// myFish 為 ["parrot", "anemone", "sturgeon"]
+// removed 為 ["blue", "trumpet"]</pre>
+
+<h3 id="從索引_-2_的位置開始,刪除_1_個元素">從索引 -2 的位置開始,刪除 1 個元素</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
+var removed = myFish.splice(-2, 1);
+
+// myFish 為 ["angel", "clown", "sturgeon"]
+// removed 為 ["mandarin"]</pre>
+
+<h3 id="從索引_2_的位置開始,刪除所有元素(含索引_2)">從索引 2 的位置開始,刪除所有元素(含索引 2)</h3>
+
+<pre class="brush: js">var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
+var removed = myFish.splice(2);
+
+// myFish 為 ["angel", "clown"]
+// removed 為 ["mandarin", "sturgeon"]</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.12', 'Array.prototype.splice')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.splice', 'Array.prototype.splice')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.splice', 'Array.prototype.splice')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.splice")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.push()", "push()")}} / {{jsxref("Array.prototype.pop()", "pop()")}} — add/remove elements from the end of the array</li>
+ <li>{{jsxref("Array.prototype.unshift()", "unshift()")}} / {{jsxref("Array.prototype.shift()", "shift()")}} — add/remove elements from the beginning of the array</li>
+ <li>{{jsxref("Array.prototype.concat()", "concat()")}} — returns a new array comprised of this array joined with other array(s) and/or value(s)</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/unshift/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/unshift/index.html
new file mode 100644
index 0000000000..7864ea6359
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/unshift/index.html
@@ -0,0 +1,101 @@
+---
+title: Array.prototype.unshift()
+slug: Web/JavaScript/Reference/Global_Objects/Array/unshift
+tags:
+ - JavaScript
+ - Method
+ - Prototype
+ - Reference
+ - unshift
+ - 陣列
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/unshift
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>unshift()</strong></code> 方法會添加一個或多個元素至陣列的開頭,並且回傳陣列的新長度。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/array-unshift.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.unshift(<var>element1</var>[, ...[, <var>elementN</var>]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>element<em>N</em></code></dt>
+ <dd>欲添加至陣列開頭的元素。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>呼叫此方法之物件的新 {{jsxref("Array.length", "length")}} 屬性值。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>unshift</code> 方法會將一或多個給定值插入至一個類陣列(array-like)物件的開頭。</p>
+
+<p><code>unshift</code> 被刻意設計為具通用性;此方法可以藉由 {{jsxref("Function.call", "called", "", 1)}} 或 {{jsxref("Function.apply", "applied", "", 1)}} 應用於類似陣列的物件上。若欲應用此方法的物件不包含代表一系列啟始為零之數字屬性序列長度的 <code>length</code> 屬性,可能是不具任何意義的行為。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var arr = [1, 2];
+
+arr.unshift(0); // 執行後的結果是3,其代表處理後的陣列長度
+// arr is [0, 1, 2]
+
+arr.unshift(-2, -1); // = 5
+// arr is [-2, -1, 0, 1, 2]
+
+arr.unshift([-3]);
+// arr is [[-3], -2, -1, 0, 1, 2]
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.4.4.13', 'Array.prototype.unshift')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.unshift")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.push()")}}</li>
+ <li>{{jsxref("Array.prototype.pop()")}}</li>
+ <li>{{jsxref("Array.prototype.shift()")}}</li>
+ <li>{{jsxref("Array.prototype.concat()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/array/values/index.html b/files/zh-tw/web/javascript/reference/global_objects/array/values/index.html
new file mode 100644
index 0000000000..6f464a3d29
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/array/values/index.html
@@ -0,0 +1,77 @@
+---
+title: Array.prototype.values()
+slug: Web/JavaScript/Reference/Global_Objects/Array/values
+translation_of: Web/JavaScript/Reference/Global_Objects/Array/values
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>values()</code></strong> 方法會回傳一個包含陣列中的每一個索引之對應值(values)的新 <strong><code>Array Iterator</code></strong> 物件。</p>
+
+<pre class="brush: js">var a = ['w', 'y', 'k', 'o', 'p'];
+var iterator = a.values();
+
+console.log(iterator.next().value); // w
+console.log(iterator.next().value); // y
+console.log(iterator.next().value); // k
+console.log(iterator.next().value); // o
+console.log(iterator.next().value); // p</pre>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>arr</var>.values()</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 {{jsxref("Array")}} 迭代器(iterator)物件。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_for...of_迴圈進行迭代">使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of">for...of</a></code> 迴圈進行迭代</h3>
+
+<pre class="brush: js">var arr = ['w', 'y', 'k', 'o', 'p'];
+var iterator = arr.values();
+
+for (let letter of iterator) {
+ console.log(letter);
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-array.prototype.values', 'Array.prototype.values')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array.prototype.values', 'Array.prototype.values')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Array.values")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Array.prototype.keys()")}}</li>
+ <li>{{jsxref("Array.prototype.entries()")}}</li>
+ <li>{{jsxref("Array.prototype.forEach()")}}</li>
+ <li>{{jsxref("Array.prototype.every()")}}</li>
+ <li>{{jsxref("Array.prototype.some()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html
new file mode 100644
index 0000000000..1fa59e5f0f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/index.html
@@ -0,0 +1,225 @@
+---
+title: ArrayBuffer
+slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer
+translation_of: Web/JavaScript/Reference/Global_Objects/ArrayBuffer
+---
+<p>{{JSRef}}</p>
+
+<p><strong><code>ArrayBuffer</code></strong> 物件是一種表示通用、固定大小的原始二進制資料緩衝。想要直接操作一個 <code>ArrayBuffer</code> 物件的內容是不可能的。若要讀寫該緩衝的內容則必須透過視圖,可以選擇建立一個 {{jsxref("DataView")}} 視圖物件或是一個限定其成員為某種型別的 {{jsxref("TypedArray")}} 視圖物件,它們皆能以特定的型別解讀、修改 <code>ArrayBuffer</code>。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new ArrayBuffer(length)
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>length</code></dt>
+ <dd>要建立的緩衝陣列大小,以位元組(byte)計算。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>為一個新建立的指定大小 <code>ArrayBuffer</code> 物件,其內容皆初始化為 0。</p>
+
+<h3 id="Exceptions">Exceptions</h3>
+
+<p>A {{jsxref("RangeError")}} is thrown if the <code>length</code> is larger than {{jsxref("Number.MAX_SAFE_INTEGER")}} (&gt;= 2 ** 53) or negative.</p>
+
+<h2 id="說明">說明</h2>
+
+<p>The <code>ArrayBuffer</code> constructor creates a new <code>ArrayBuffer</code> of the given length in bytes.</p>
+
+<h3 id="從既有的資料取得_ArrayBuffer">從既有的資料取得 ArrayBuffer</h3>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Appendix.3A_Decode_a_Base64_string_to_Uint8Array_or_ArrayBuffer">From a Base64 string</a></li>
+ <li><a href="/zh-TW/docs/Web/API/FileReader#readAsArrayBuffer()">從本地端檔案</a></li>
+</ul>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>ArrayBuffer.length</code></dt>
+ <dd>The <code>ArrayBuffer</code> constructor's length property whose value is 1.</dd>
+ <dt>{{jsxref("ArrayBuffer.@@species", "get ArrayBuffer[@@species]")}}</dt>
+ <dd>The constructor function that is used to create derived objects.</dd>
+ <dt>{{jsxref("ArrayBuffer.prototype")}}</dt>
+ <dd>Allows the addition of properties to all <code>ArrayBuffer</code> objects.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("ArrayBuffer.isView", "ArrayBuffer.isView(arg)")}}</dt>
+ <dd>Returns <code>true</code> if <code>arg</code> is one of the ArrayBuffer views, such as <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">typed array objects</a> or a {{jsxref("DataView")}}. Returns <code>false</code> otherwise.</dd>
+ <dt>{{jsxref("ArrayBuffer.transfer", "ArrayBuffer.transfer(oldBuffer [, newByteLength])")}} {{experimental_inline}}</dt>
+ <dd>
+ <div class="line" id="file-arraybuffer-transfer-LC6">Returns a new <code>ArrayBuffer</code> whose contents are taken from the <code>oldBuffer</code>'s data and then is either truncated or zero-extended by <code>newByteLength</code>.</div>
+ </dd>
+</dl>
+
+<h2 id="ArrayBuffer_實例"><code>ArrayBuffer</code> 實例</h2>
+
+<p>所有的 <code>ArrayBuffer</code> 物件實例皆繼承自 {{jsxref("ArrayBuffer.prototype")}}.</p>
+
+<h3 id="屬性_2">屬性</h3>
+
+<p>{{page('zh-TW/Web/JavaScript/JavaScript_typed_arrays/ArrayBuffer/prototype','屬性')}}</p>
+
+<h3 id="方法_2">方法</h3>
+
+<p>{{page('/zh-TW/docs/Web/JavaScript/JavaScript_typed_arrays/ArrayBuffer/prototype','方法')}}</p>
+
+<dl>
+ <dt>{{jsxref("ArrayBuffer.slice()")}} {{non-standard_inline}}</dt>
+ <dd>Has the same functionality as {{jsxref("ArrayBuffer.prototype.slice()")}}.</dd>
+</dl>
+
+<h2 id="範例">範例</h2>
+
+<p>In this example, we create a 8-byte buffer with a {{jsxref("Global_Objects/Int32Array", "Int32Array")}} view referring to the buffer:</p>
+
+<pre class="brush: js">var buffer = new ArrayBuffer(8);
+var view = new Int32Array(buffer);</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Typed Array')}}</td>
+ <td>{{Spec2('Typed Array')}}</td>
+ <td>Superseded by ECMAScript 6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-arraybuffer-constructor', 'ArrayBuffer')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition in an ECMA standard. Specified that <code>new</code> is required.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-arraybuffer-constructor', 'ArrayBuffer')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("2")}}</td>
+ <td>10</td>
+ <td>11.6</td>
+ <td>5.1</td>
+ </tr>
+ <tr>
+ <td><code>ArrayBuffer()</code> without <code>new</code> throws</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("44")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>ArrayBuffer.slice()</code> {{non-standard_inline}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}<br>
+ {{CompatNo}} {{CompatGeckoDesktop("53")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>4.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("2")}}</td>
+ <td>10</td>
+ <td>11.6</td>
+ <td>4.2</td>
+ </tr>
+ <tr>
+ <td><code>ArrayBuffer()</code> without <code>new</code> throws</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("44")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>ArrayBuffer.slice()</code> {{non-standard_inline}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}<br>
+ {{CompatNo}} {{CompatGeckoMobile("53")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相容性備註">相容性備註</h2>
+
+<p>Starting with ECMAScript 2015, <code>ArrayBuffer</code> constructors require to be constructed with a {{jsxref("Operators/new", "new")}} operator. Calling an <code>ArrayBuffer</code> constructor as a function without <code>new</code>, will throw a {{jsxref("TypeError")}} from now on.</p>
+
+<pre class="brush: js example-bad">var dv = ArrayBuffer(10);
+// TypeError: calling a builtin ArrayBuffer constructor
+// without new is forbidden</pre>
+
+<pre class="brush: js example-good">var dv = new ArrayBuffer(10);</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("TypedArray")}}</li>
+ <li>{{jsxref("SharedArrayBuffer")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html
new file mode 100644
index 0000000000..8883a89cec
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/arraybuffer/prototype/index.html
@@ -0,0 +1,110 @@
+---
+title: ArrayBuffer.prototype
+slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/ArrayBuffer
+---
+<div>{{JSRef}}</div>
+
+<p>The <strong><code>ArrayBuffer.prototype</code></strong> property represents the prototype for the {{jsxref("ArrayBuffer")}} object.</p>
+
+<div>{{js_property_attributes(0,0,0)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p><code>ArrayBuffer</code> instances inherit from <code>ArrayBuffer.prototype</code>. As with all constructors, you can change the constructor's prototype object to make changes to all <code>ArrayBuffer</code> instances.</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>ArrayBuffer.prototype.constructor</dt>
+ <dd>Specifies the function that creates an object's prototype. The initial value is the standard built-in <code>ArrayBuffer</code> constructor.</dd>
+ <dt>{{jsxref("ArrayBuffer.prototype.byteLength")}} {{readonlyInline}}</dt>
+ <dd>陣列大小,以位元組(byte)計算。此屬性在陣列建立之後就不可能改變了。<strong>唯讀</strong>。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("ArrayBuffer.prototype.slice()")}}</dt>
+ <dd>Returns a new <code>ArrayBuffer</code> whose contents are a copy of this <code>ArrayBuffer</code>'s bytes from <code>begin</code>, inclusive, up to <code>end</code>, exclusive. If either <code>begin</code> or <code>end</code> is negative, it refers to an index from the end of the array, as opposed to from the beginning.</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-arraybuffer.prototype', 'ArrayBuffer.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-arraybuffer.prototype', 'ArrayBuffer.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0</td>
+ <td>{{ CompatGeckoDesktop("2")}}</td>
+ <td>10</td>
+ <td>11.6</td>
+ <td>5.1</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>4.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("2")}}</td>
+ <td>10</td>
+ <td>11.6</td>
+ <td>4.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html b/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html
new file mode 100644
index 0000000000..c25f3ee3a1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/asyncfunction/index.html
@@ -0,0 +1,118 @@
+---
+title: AsyncFunction
+slug: Web/JavaScript/Reference/Global_Objects/AsyncFunction
+translation_of: Web/JavaScript/Reference/Global_Objects/AsyncFunction
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Async</strong></code><strong><code>Function</code> 建構子</strong>建立一個新的 {{jsxref("Statements/async_function", "async function")}}  物件。在 JavaScript 中,每一個非同步函數實際上是一個 <code>AsyncFunction</code> 物件。</p>
+
+<p>注意 <code>AsyncFunction</code> 不是一個全域物件。 它可以以下程式碼獲得。</p>
+
+<pre class="brush: js">Object.getPrototypeOf(async function(){}).constructor
+</pre>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new AsyncFunction([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>Names to be used by the function as formal argument names. Each must be a string that corresponds to a valid JavaScript identifier or a list of such strings separated with a comma; for example "<code>x</code>", "<code>theValue</code>", or "<code>a,b</code>".</dd>
+ <dt><code>functionBody</code></dt>
+ <dd>一個字串。描述該函數定義的陳述式(statements)。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>{{jsxref("Statements/async_function", "async function")}} objects created with the <code>AsyncFunction</code> constructor are parsed when the function is created. This is less efficient than declaring an async function with an {{jsxref("Statements/async_function", "async function expression")}} and calling it within your code, because such functions are parsed with the rest of the code.</p>
+
+<p>All arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed.</p>
+
+<div class="note">
+<p><strong>Note:</strong> {{jsxref("Statements/async_function", "async functions")}} created with the <code>AsyncFunction</code> constructor do not create closures to their creation contexts; they are always created in the global scope. When running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the <code>AsyncFunction</code> constructor was called. This is different from using {{jsxref("Global_Objects/eval", "eval")}} with code for an async function expression.</p>
+</div>
+
+<p>以函數的方式執行 <code>AsyncFunction</code> 建構式 (不使用 <code>new</code> 運算子) 和以建構子的方式執行是等效的。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code><strong>AsyncFunction.length</strong></code></dt>
+ <dd><code>AsyncFuction</code> 建構子的長度為 1。</dd>
+ <dt>{{jsxref("AsyncFunction.prototype")}}</dt>
+ <dd>可加入屬性至所有陣列物件。</dd>
+</dl>
+
+<h2 id="AsyncFunction_原型物件"><code>AsyncFunction</code> 原型物件</h2>
+
+<h3 id="屬性_2">屬性</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction/prototype', 'Properties')}}</div>
+
+<h2 id="AsyncFunction_實例"><code>AsyncFunction</code> 實例</h2>
+
+<p><code>AsyncFunction</code> 實例繼承 {{jsxref("AsyncFunction.prototype")}} 的屬性和方法. 和所有的建構子一樣,變更該建構子 (constructor) 的原型物件 (prototype object)將會影響所有的 <code>AsyncFunction</code> 實例。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="AsyncFunction_建構子建立一個非同步函數"> <code>AsyncFunction</code> 建構子建立一個非同步函數</h3>
+
+<pre class="brush: js">function resolveAfter2Seconds(x) {
+ return new Promise(resolve =&gt; {
+ setTimeout(() =&gt; {
+ resolve(x);
+ }, 2000);
+ });
+}
+
+var AsyncFunction = Object.getPrototypeOf(async function(){}).constructor
+
+var a = new AsyncFunction('a',
+ 'b',
+ 'return await resolveAfter2Seconds(a) + await resolveAfter2Seconds(b);');
+
+a(10, 20).then(v =&gt; {
+ console.log(v); // prints 30 after 4 seconds
+});
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-objects', 'AsyncFunction object')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Initial definition in ES2017.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.AsyncFunction")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Statements/async_function", "async function function")}}</li>
+ <li>{{jsxref("Operators/async_function", "async function expression")}}</li>
+ <li>{{jsxref("Global_Objects/Function", "Function")}}</li>
+ <li>{{jsxref("Statements/function", "function statement")}}</li>
+ <li>{{jsxref("Operators/function", "function expression")}}</li>
+ <li>{{jsxref("Functions_and_function_scope", "Functions and function scope", "", 1)}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html
new file mode 100644
index 0000000000..705a85e255
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/bigint/index.html
@@ -0,0 +1,279 @@
+---
+title: BigInt
+slug: Web/JavaScript/Reference/Global_Objects/BigInt
+translation_of: Web/JavaScript/Reference/Global_Objects/BigInt
+---
+<p>{{JSRef}}{{SeeCompatTable}}</p>
+
+<p><code>BigInt</code> 是一個內建的物件,提供了表示大於2<sup>53</sup>的整數的功能 (2<sup>53</sup>是JavaScript原生的{{JSxRef("Number")}}能夠表示的最大值)</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">BigInt(value);
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>欲創建的數值,可以為整數或字串。</dd>
+</dl>
+
+<div class="blockIndicator note">
+<p><strong>Note</strong>: <code>BigInt()</code> 不和 {{JSxRef("Operators/new", "new")}} 一起使用。</p>
+</div>
+
+<dl>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p><code>BigInt</code> 是透過在一個數值後加上 <code>n</code> ,例如 <code>10n</code> ,或呼叫 <code>BigInt()</code> 所生成的。</p>
+
+<pre class="brush: js">const theBiggestInt = 9007199254740991n;
+
+const alsoHuge = BigInt(9007199254740991);
+// ↪ 9007199254740991n
+
+const hugeString = BigInt("9007199254740991");
+// ↪ 9007199254740991n
+
+const hugeHex = BigInt("0x1fffffffffffff");
+// ↪ 9007199254740991n
+
+const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111");
+// ↪ 9007199254740991n
+</pre>
+
+<p><code>BigInt</code> 跟 {{JSxRef("Number")}} 很像,但在某些部分有些許不同 — 它不可以被用在內建的 {{JSxRef("Math")}} 物件方法中、而且不可以跟 <code>Number</code> 的實體混用運算子。</p>
+
+<div class="blockIndicator warning">
+<p>{{JSxRef("Number")}} 和 <code>BigInt</code> 不能混和計算 — 他們必須被轉換到同一個型態。</p>
+
+<p>然而,在相互轉換時要注意, <code>BigInt</code> 在被轉換成 <code>Number</code> 時可能會遺失部分精度的資訊。</p>
+</div>
+
+<h3 id="類別資訊">類別資訊</h3>
+
+<p>當使用 <code>typeof</code> 測試時,一個 <code>BigInt</code> 會回傳 "bigint":</p>
+
+<pre class="brush: js">typeof 1n === 'bigint'; // true
+typeof BigInt('1') === 'bigint'; // true
+</pre>
+
+<p>當使用 <code>Object</code> 來包裹時,<code>BigInt</code> 會被看成是普通的 "object" 型態:</p>
+
+<pre class="brush: js">typeof Object(1n) === 'object'; // true
+</pre>
+
+<h3 id="Operators">Operators</h3>
+
+<p>下列的運算子可以被用在 <code>BigInt</code> 上 (或由object包裹的 <code>BigInt</code>): <code>+</code>, <code>*</code>, <code>-</code>, <code>**</code>, <code>%</code>.</p>
+
+<pre class="brush: js">const previousMaxSafe = BigInt(Number.MAX_SAFE_INTEGER);
+// ↪ 9007199254740991
+
+const maxPlusOne = previousMaxSafe + 1n;
+// ↪ 9007199254740992n
+
+const theFuture = previousMaxSafe + 2n;
+// ↪ 9007199254740993n, this works now!
+
+const multi = previousMaxSafe * 2n;
+// ↪ 18014398509481982n
+
+const subtr = multi – 10n;
+// ↪ 18014398509481972n
+
+const mod = multi % 10n;
+// ↪ 2n
+
+const bigN = 2n ** 54n;
+// ↪ 18014398509481984n
+
+bigN * -1n
+// ↪ –18014398509481984n
+</pre>
+
+<p><code>/</code> 運算子也同樣的能夠運行。然而,因為型態是 <code>BigInt</code> 而不是 <code>BigDecimal</code> ,除法運算會無條件捨去小數。也就是說,回傳值不會包含小數部分。</p>
+
+<div class="blockIndicator warning">
+<p>回傳值帶小數的運算在使用<code>BigInt</code>  時小數部分會被捨去。</p>
+</div>
+
+<pre class="brush: js">const expected = 4n / 2n;
+// ↪ 2n
+
+const rounded = 5n / 2n;
+// ↪ 2n, not 2.5n
+
+</pre>
+
+<h3 id="比較">比較</h3>
+
+<p>一個 <code>BigInt</code> 並不嚴格等於一個 {{JSxRef("Global_Objects/Number", "Number")}},但他們會一般相等。</p>
+
+<pre class="brush: js">0n === 0
+// ↪ false
+
+0n == 0
+// ↪ true</pre>
+
+<p>一個 {{JSxRef("Global_Objects/Number", "Number")}} 和 <code>BigInt</code> 可以像普通運算一樣比較。</p>
+
+<pre class="brush: js">1n &lt; 2
+// ↪ true
+
+2n &gt; 1
+// ↪ true
+
+2 &gt; 2
+// ↪ false
+
+2n &gt; 2
+// ↪ false
+
+2n &gt;= 2
+// ↪ true</pre>
+
+<p>他們可以參雜在陣列中並照預期的被排序。</p>
+
+<pre class="brush: js">const mixed = [4n, 6, -12n, 10, 4, 0, 0n];
+// ↪ [4n, 6, -12n, 10, 4, 0, 0n]
+
+mixed.sort();
+// ↪ [-12n, 0, 0n, 10, 4n, 4, 6]
+</pre>
+
+<p>Note that comparisons with <code>Object</code>-wrapped <code>BigInt</code>s act as with other objects, only indicating equality when the same object instance is compared:</p>
+
+<pre class="brush: js">0n === Object(0n); // false
+Object(0n) === Object(0n); // false
+
+const o = Object(0n);
+o === o // true
+</pre>
+
+<h3 id="Conditionals">Conditionals</h3>
+
+<p>A <code>BigInt</code> behaves like a {{JSxRef("Global_Objects/Number", "Number")}} in cases where it is converted to a {{JSxRef("Global_Objects/Boolean", "Boolean")}}: via the {{JSxRef("Global_Objects/Boolean", "Boolean")}} function; when used with logical operators {{JSxRef("Operators/Logical_Operators", "Logical Operators")}} <code>||</code>, <code>&amp;&amp;</code>, and <code>!</code>; or within a conditional test like an {{JSxRef("Statements/if...else", "if statement")}}.</p>
+
+<pre class="brush: js">if (0n) {
+ console.log('Hello from the if!');
+} else {
+ console.log('Hello from the else!');
+}
+
+// ↪ "Hello from the else!"
+
+0n || 12n
+// ↪ 12n
+
+0n &amp;&amp; 12n
+// ↪ 0n
+
+Boolean(0n)
+// ↪ false
+
+Boolean(12n)
+// ↪ true
+
+!12n
+// ↪ false
+
+!0n
+// ↪ true
+</pre>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{JSxRef("BigInt.asIntN()")}}</dt>
+ <dd>Wraps a BigInt between -2<sup>width-1</sup> and 2<sup>width-1</sup>-1</dd>
+ <dt>{{JSxRef("BigInt.asUintN()")}}</dt>
+ <dd>Wraps a BigInt between 0 and 2<sup>width</sup>-1</dd>
+</dl>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{JSxRef("BigInt.prototype")}}</dt>
+ <dd>允許對一個 <code>BigInt</code> 物件增加其屬性。</dd>
+</dl>
+
+<h2 id="BigInt_物件實體"><code>BigInt</code> 物件實體</h2>
+
+<p>All <code>BigInt</code> instances inherit from <code>BigInt.prototype</code>. The prototype object of the <code>BigInt</code> constructor can be modified to affect all <code>BigInt</code> instances.</p>
+
+<h3 id="方法_2">方法</h3>
+
+<p>{{page("/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/prototype", "Methods")}}</p>
+
+<h2 id="建議用法">建議用法</h2>
+
+<h3 id="轉型">轉型</h3>
+
+<p>因為在 {{JSxRef("Global_Objects/Number", "Number")}} 和 <code>BigInt</code> 之間轉換可能造成精度遺失,建議當數值會超過2<sup>53</sup>時只使用 <code>BigInt</code> ,而不要在兩者之間進行轉換。</p>
+
+<h3 id="加密">加密</h3>
+
+<p><code>BigInt</code> 支援的運算並非常數時間。因此 <code>BigInt</code> <a href="https://www.chosenplaintext.ca/articles/beginners-guide-constant-time-cryptography.html">不適用在加密學上</a>。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="計算質數">計算質數</h3>
+
+<pre class="brush: js">function isPrime(p) {
+ for (let i = 2n; i * i &lt;= p; i++) {
+ if (p % i === 0n) return false;
+ }
+ return true;
+}
+
+// Takes a BigInt as an argument and returns a BigInt
+function nthPrime(nth) {
+ let maybePrime = 2n;
+ let prime = 0n;
+
+ while (nth &gt;= 0n) {
+ if (isPrime(maybePrime)) {
+ nth -= 1n;
+ prime = maybePrime;
+ }
+ maybePrime += 1n;
+ }
+
+ return prime;
+}
+
+nthPrime(20n)
+// ↪ 73n</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ </tr>
+ <tr>
+ <td><a href="https://tc39.github.io/proposal-bigint/#sec-bigint-objects">BigInt</a></td>
+ <td>Stage 3</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.BigInt")}}</p>
+</div>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{JSxRef("Number")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html b/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html
new file mode 100644
index 0000000000..6c8d690b15
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/boolean/index.html
@@ -0,0 +1,199 @@
+---
+title: Boolean
+slug: Web/JavaScript/Reference/Global_Objects/Boolean
+translation_of: Web/JavaScript/Reference/Global_Objects/Boolean
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Boolean</code></strong> 是布林值的包覆器。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new Boolean([<var>value</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code> {{optional_inline}}</dt>
+ <dd>這個<code>Boolean</code>物件的初始值。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>傳入的第一個參數值,如果需要的話,會被轉換成布林值。如果沒傳值,或者是<code>0</code>、<code>-0</code>、{{jsxref("null")}}、<code>false</code>、{{jsxref("NaN")}}、{{jsxref("undefined")}}、空字串(<code>""</code>)的話,這個物件的值會被初始化成<code>false</code>。大多數情況下,DOM 物件 {{domxref("document.all")}} 被傳入後,也會將其初始化為<code>false</code>。至於其他的值,包含所有物件或<code>"false"</code>字串,都會使其初始化為<code>true</code>。</p>
+
+<p>不要將原始型別的布林值和這個布林物件搞混,它們並不相同。</p>
+
+<p>在判斷式中,任何物件只要不是 {{jsxref("undefined")}} 或 {{jsxref("null")}} ,儘管是值為<code>false</code> 的 <code>Boolean</code> 物件,都會被轉換成<code>true</code>。舉例來說,下列的 {{jsxref("Statements/if...else", "if")}} 判斷式中的布林值即為<code>true</code>:</p>
+
+<pre class="brush: js">var x = new Boolean(false);
+if (x) {
+ // this code is executed
+}
+</pre>
+
+<p>以上這個行為和<code>Boolean</code>原始型別沒有關連,反倒是下面的 {{jsxref("Statements/if...else", "if")}} 判斷式會正確地將其視為<code>false</code>:</p>
+
+<pre class="brush: js">var x = false;
+if (x) {
+ // this code is not executed
+}
+</pre>
+
+<p>不要用<code>Boolean</code>物件將非布林值轉換成布林值。反而要將<code>Boolean</code>視為函式去轉換非布林值:</p>
+
+<pre class="brush: js">var x = Boolean(expression); // 較好
+var x = new Boolean(expression); // 不要用
+</pre>
+
+<p>如果你要指定任何物件,包括值為<code>false</code>的<code>Boolean</code>物件,作為<code>Boolean</code>物件的初始值,則該<code>Boolean</code>物件的值依舊為<code>true</code>。</p>
+
+<pre class="brush: js">var myFalse = new Boolean(false); // 初始值給false,實際上為true
+var g = new Boolean(myFalse); // 想當然耳,true
+var myString = new String('Hello'); // 字串物件,'Hello'
+var s = new Boolean(myString); // 依舊為true
+</pre>
+
+<p>不要使用<code>Boolean</code>物件代替<code>Boolean</code>的原始型別!</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Boolean.length</code></dt>
+ <dd>長度永遠為1。</dd>
+ <dt>{{jsxref("Boolean.prototype")}}</dt>
+ <dd>原型為<code>Boolean</code>的建構式。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>全域的<code>Boolean</code>物件自身沒有任何方法,它只有從原型鏈繼承而來的方法。</p>
+
+<h2 id="Boolean_實體"><code>Boolean</code> 實體</h2>
+
+<p>所有 <code>Boolean</code> 實體會繼承 {{jsxref("Boolean.prototype")}} 。和所有建構式一樣,原型物件會指派給實體那些繼承的屬性和方法。</p>
+
+<h3 id="屬性_2">屬性</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/prototype', 'Properties')}}</div>
+
+<h3 id="方法_2">方法</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/prototype', 'Methods')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="用_false_作為初始值建立_Boolean_物件">用 <code>false</code> 作為初始值建立 <code>Boolean</code> 物件</h3>
+
+<pre class="brush: js">var bNoParam = new Boolean();
+var bZero = new Boolean(0);
+var bNull = new Boolean(null);
+var bEmptyString = new Boolean('');
+var bfalse = new Boolean(false);
+</pre>
+
+<h3 id="用_true_作為初始值建立_Boolean_物件">用 <code>true</code> 作為初始值建立 <code>Boolean</code> 物件</h3>
+
+<pre class="brush: js">var btrue = new Boolean(true);
+var btrueString = new Boolean('true');
+var bfalseString = new Boolean('false');
+var bSuLin = new Boolean('Su Lin');
+var bArrayProto = new Boolean([]);
+var bObjProto = new Boolean({});
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註記</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.6', 'Boolean')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-boolean-objects', 'Boolean')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-boolean-objects', 'Boolean')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatIE("6.0")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Boolean.prototype")}}</li>
+ <li>{{Glossary("Boolean")}}</li>
+ <li><a href="http://en.wikipedia.org/wiki/Boolean_data_type">Boolean data type (Wikipedia)</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html b/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html
new file mode 100644
index 0000000000..d7cf6d6ed4
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/dataview/index.html
@@ -0,0 +1,173 @@
+---
+title: DataView
+slug: Web/JavaScript/Reference/Global_Objects/DataView
+translation_of: Web/JavaScript/Reference/Global_Objects/DataView
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>DataView</code></strong> 視圖提供了一個底層介面來讀寫 {{jsxref("ArrayBuffer")}} 中的二進位資料。<code>DataView</code> 能用多種不同的型別對 <code>ArrayBuffer</code> 進行修改、解讀,且可自訂資料的位元組順序而不受系統平台限制。<code>DataView</code> 物件僅為視圖,並不會存放資料,所有的資料皆實際儲存於 <code>ArrayBuffer</code> 物件當中。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new DataView(buffer [, byteOffset [, byteLength]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>buffer</code></dt>
+ <dd>要給DataView物件操作的資料容器並且不能為null</dd>
+ <dt><code>byteOffset</code> {{optional_inline}}</dt>
+ <dd>The offset, in bytes, to the first byte in the specified buffer for the new view to reference. If not specified, the view of the buffer will start with the first byte.</dd>
+ <dt><code>byteLength</code> {{optional_inline}}</dt>
+ <dd>The number of elements in the byte array. If unspecified, length of the view will match the buffer's length.</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A new <code>DataView</code> object representing the specified data buffer.</p>
+
+<h3 id="Errors_thrown">Errors thrown</h3>
+
+<dl>
+ <dt><code>{{jsxref("RangeError")}}</code></dt>
+ <dd>Thrown if the <code>byteOffset</code> and <code>byteLength</code> result in the specified view extending past the end of the buffer.</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<h3 id="位元組順序">位元組順序</h3>
+
+<p>Multi-byte number formats are represented in memory differently depending on machine architecture, see {{Glossary("Endianness")}} for an explanation. DataView accessors provide explicit control of how data will be accessed irrespective of the platform architecture's endianness.</p>
+
+<pre class="brush: js">var littleEndian = (function() {
+ var buffer = new ArrayBuffer(2);
+ new DataView(buffer).setInt16(0, 256, true /* littleEndian */);
+ // Int16Array uses the platform's endianness.
+ return new Int16Array(buffer)[0] === 256;
+})();
+console.log(littleEndian); // true or false
+</pre>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>DataView.length</dt>
+ <dd>The <code>DataView</code> constructor's length property whose value is 3.</dd>
+ <dt>{{jsxref("DataView.prototype")}}</dt>
+ <dd>Allows the addition of properties to all <code>DataView</code> objects.</dd>
+</dl>
+
+<h2 id="DataView_實例"><code>DataView</code> 實例</h2>
+
+<p>All <code>DataView</code> instances inherit from {{jsxref("DataView.prototype")}}.</p>
+
+<h3 id="屬性_2">屬性</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/DataView/prototype','Properties')}}</p>
+
+<h3 id="方法">方法</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/DataView/prototype','Methods')}}</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var buffer = new ArrayBuffer(16);
+var dv = new DataView(buffer, 0);
+
+dv.setInt16(1, 42);
+dv.getInt16(1); //42
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Typed Array')}}</td>
+ <td>{{Spec2('Typed Array')}}</td>
+ <td>Superseded by ECMAScript 6</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-dataview-constructor', 'DataView')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition in an ECMA standard</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-dataview-constructor', 'DataView')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>9.0</td>
+ <td>{{CompatGeckoDesktop("15.0")}}</td>
+ <td>10</td>
+ <td>12.1</td>
+ <td>5.1</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>4.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("15")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>12.0</td>
+ <td>4.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Firefox-specific_notes">Firefox-specific notes</h2>
+
+<p>Starting with Gecko / SpiderMonkey 40 {{geckoRelease(40)}}, <code>DataView</code> requires to be constructed with a {{jsxref("Operators/new", "new")}} operator. Calling <code>DataView()</code> as a function without <code>new</code>, will throw a {{jsxref("TypeError")}} from now on.</p>
+
+<pre class="brush: js example-bad">var dv = DataView(buffer, 0);
+// TypeError: calling a builtin DataView constructor without new is forbidden</pre>
+
+<pre class="brush: js example-good">var dv = new DataView(buffer, 0);</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a class="link-https" href="https://github.com/jDataView/jDataView">jDataView</a>: JavaScript library that polyfills and extends the <code>DataView</code> API to all browsers and Node.js.</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html
new file mode 100644
index 0000000000..abdc0e89a1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/date/getday/index.html
@@ -0,0 +1,72 @@
+---
+title: Date.prototype.getDay()
+slug: Web/JavaScript/Reference/Global_Objects/Date/getDay
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay
+---
+<div>{{JSRef}}</div>
+
+<p><span class="seoSummary"><strong><code>getDay()</code></strong> 方法會根據當地時間將指定日期返回一星期中的第幾天,</span>其中0代表星期日。 在當月的某天可以參考{{jsxref("Date.prototype.getDate()")}}。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/date-getday.html", "shorter")}}</div>
+
+<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate"><code><var>dateObj</var>.getDay()</code></pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>返回一個整數,數值介於0到6之間,取決於當地時間對應出指定日期為星期幾:0代表星期日,1代表星期一,2代表星期二,依此類推。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_getDay">使用 <code>getDay()</code></h3>
+
+<p>下面第二行表示根據日期對象'Xmas95'的值,把1賦值給'weekday'。則1995年12月25日是星期一。</p>
+
+<pre class="brush: js notranslate">var Xmas95 = new Date('December 25, 1995 23:15:30');
+var weekday = Xmas95.getDay();
+
+console.log(weekday); // 1
+</pre>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> 如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}加上<code>options</code>參數來獲取星期幾全名。使使用此方法能輕鬆做出各種國際語言:</p>
+
+<pre class="brush: js notranslate">var options = { weekday: 'long'};
+console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
+// Monday
+console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95));
+// Montag
+</pre>
+</div>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date.prototype.getday', 'Date.prototype.getDay')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器兼容性">瀏覽器兼容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Date.getDay")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Date.prototype.getUTCDate()")}}</li>
+ <li>{{jsxref("Date.prototype.getUTCDay()")}}</li>
+ <li>{{jsxref("Date.prototype.setDate()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/index.html
new file mode 100644
index 0000000000..91c0305aa4
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/date/index.html
@@ -0,0 +1,263 @@
+---
+title: Date
+slug: Web/JavaScript/Reference/Global_Objects/Date
+tags:
+ - Date
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Global_Objects/Date
+---
+<div>{{JSRef}}</div>
+
+<p>建立一個  JavaScript <strong><code>Date</code></strong> 物件來指向某一個時間點。Date 物件是基於世界標準時間(UTC) 1970 年 1 月 1 日開始的毫秒數值來儲存時間。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new Date();
+new Date(<var>value</var>);
+new Date(<var>dateString</var>);
+new Date(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <var>minutes</var>[, <var>seconds</var>[, <var>milliseconds</var>]]]]]);
+</pre>
+
+<div class="note">
+<p><strong>附註:</strong> JavaScript <code>Date</code> 物件只能由以 Date 作為建構子來產生,如果把 Date 作為一般的函數來呼叫(省略掉 {{jsxref("Operators/new", "new")}} 運算子)將會得到一個字串而非 Date 物件;與其它 JavaScript 物件不同,它並沒有物件實體語法(例如:以中刮號 [ ] 表示陣列的宣告方式)。</p>
+</div>
+
+<h3 id="參數">參數</h3>
+
+<div class="note">
+<p><strong>附註:</strong>當傳入超過一個參數到 Date 建構子,若參數值超過它的合理範圍(例如:傳數值 13 到月份,或傳數值 70 給分鐘),相鄰的參數值將會被調整。例如: <code>new Date(2013, 13, 1)</code> 將等同於 <code>new Date(2014, 1, 1)</code> 都會建立代表 <code>2014-02-01</code> 的物件(注意月份值由 0 開始)。同樣的, <code>new Date(2013, 2, 1, 0, 70)</code> 與 <code>new Date(2013, 2, 1, 1, 10)</code> 一樣會建立代表 <code>2013-03-01T01:10:00</code> 的 Date 物件。</p>
+</div>
+
+<div class="note">
+<p><strong>附註:</strong>當傳入超過一個參數到 Date 建構子,所指定的參數值會視為本地時間。如果希望指定的值為世界標準時間(UTC),則應使用 <code>new Date({{jsxref("Date.UTC()", "Date.UTC(...)")}})</code> 語法,傳入一樣格式的參數。</p>
+</div>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>自世界標準時間(UTC) 1970 年 1 月 1 日 00:00:00 開始的毫秒整數(Integer)值(Unix 紀元;但要注意到大多 Unix 時間<span class="short_text" id="result_box" lang="zh-CN"><span>戳記是以秒而非毫秒為單位)。</span></span></dd>
+ <dt><code>dateString</code></dt>
+ <dd>表示時間日期的字串。這個字串應該要能被 {{jsxref("Date.parse()")}} 方法解析(符合 <a href="http://tools.ietf.org/html/rfc2822#page-14">IETF-compliant RFC 2822 timestamps</a> 及 <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15">version of ISO8601</a> 格式要求).
+ <div class="note">
+ <p><strong>附註:</strong> 由於各家瀏覽器有所不同且具有差異性,因此非常不鼓勵使用 Date 建構子(或 <code>Date.parse</code> 方法,它們是同等的)來解析時間日期字串。</p>
+ </div>
+ </dd>
+ <dt><code>year</code></dt>
+ <dd>表示年份的整數。當數值落在 0 到 99 之間,表示 1900 到 1999 之間的年份。參考{{anch("Two_digit_years_map_to_1900_-_1999", "下面的範例")}}.</dd>
+ <dt><code>month</code></dt>
+ <dd>表示月份的整數。由 0 開始(一月)到 11 (十二月)。</dd>
+ <dt><code>day</code></dt>
+ <dd>選用。表示月份中第幾天的整數值。</dd>
+ <dt><code>hour</code></dt>
+ <dd>選用。表示小時數的整數值。</dd>
+ <dt><code>minute</code></dt>
+ <dd>選用。表示分鐘數的整數值。</dd>
+ <dt><code>second</code></dt>
+ <dd>選用。表示秒數的整數值。</dd>
+ <dt><code>millisecond</code></dt>
+ <dd>選用。表示毫秒數的整數值。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<ul>
+ <li>如果沒有傳入任務參數到建構子,會依系統設定建立出代表當下時間的 Date 物件。</li>
+ <li>如果傳入至少兩個參數,缺少日期的話會設為 1,其它參數則會被設定為 0。</li>
+ <li>JavaScript 的 date 基於世界標準時間(UTC)1970 年 1 月 1 日午夜的毫秒數。一天有 86,400,000 毫秒。JavaScript <code>Date</code> 物件可表示的範圍由世界標準時間(UTC) 1970 年 1 月 1 日為基準的 -100,000,000 天到 100,000,000 天。</li>
+ <li>JavaScript <code>Date</code> 物件提供跨平台一致的行為。這個時間數值可以在系統之間傳遞表示相同的時間,如果建立本地的時間物件,其表現將會與本地習慣相對應。</li>
+ <li>JavaScript <code>Date</code> 物件提供了若干 UTC (通用的) 以及本地時間方法。UTC,也被稱為格林威治標準時間(GMT)被指定作為世界時間的標準。本地時間指的是被設定在執行 JavaScript 電腦上的時間。</li>
+ <li>以函數方式呼叫 <code>Date</code> (也就是省略 {{jsxref("Operators/new", "new")}} 建構子)將會回傳一個表示當下時間日期的字串。</li>
+</ul>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Date.prototype")}}</dt>
+ <dd>允許填加屬於到 JavaScript <code>Date</code> 物件。</dd>
+ <dt><code>Date.length</code></dt>
+ <dd><code>Date.length</code> 的值為 7。這是建構子能夠處理的參數數量。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Date.now()")}}</dt>
+ <dd>回傳對應於當下時間的數值 - 1970/01/01 00:00:00 (UTC) 到當下的毫秒數。</dd>
+ <dt>{{jsxref("Date.parse()")}}</dt>
+ <dd>解析字串所表示的時間,回傳由 1970/01/01 00:00:00 (UTC) 到該時間的毫秒數值。
+ <div class="note">
+ <p><strong>附註:</strong>由於瀏覽器之間的不同與差異,強烈不建議使用 <code>Date.parse</code> 。</p>
+ </div>
+ </dd>
+ <dt>{{jsxref("Date.UTC()")}}</dt>
+ <dd>需要傳入與建構子相同的參數數目(即 2 到 7 個),會得到由 1970-01-01 00:00:00 UTC 到該日期時間的毫秒數。(輸入的參數會視為世界標準時間,而非本地時間)</dd>
+</dl>
+
+<h2 id="JavaScript_Date_物件實體">JavaScript <code>Date</code> 物件實體</h2>
+
+<p>所有 <code>Date</code> 物件實體繼承自 {{jsxref("Date.prototype")}} 。這個 Date 建構子的 prototype 物件可以被修改以影響所有 Date 物件實體。</p>
+
+<h3 id="Date.prototype_方法">Date.prototype 方法</h3>
+
+<div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Date/prototype', '方法')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="幾種建立_Date_物件的方式">幾種建立 Date 物件的方式</h3>
+
+<p>接下來的幾個範例,展示幾種建立 Date 物件的方式:</p>
+
+<div class="note">
+<p><strong>附註:</strong> 由於瀏覽器之間的不同與差異,強烈不建議使用解析字串的方式建立 Date 物件。</p>
+</div>
+
+<pre class="brush: js">var today = new Date();
+var birthday = new Date('December 17, 1995 03:24:00');
+var birthday = new Date('1995-12-17T03:24:00');
+var birthday = new Date(1995, 11, 17);
+var birthday = new Date(1995, 11, 17, 3, 24, 0);
+</pre>
+
+<h3 id="兩位數的年份對應到_1900_-_1999">兩位數的年份對應到 1900 - 1999</h3>
+
+<p>為了建立及取得西元 0 到 99 的日期,應該使用 {{jsxref("Date.prototype.setFullYear()")}} 以及 {{jsxref("Date.prototype.getFullYear()")}} 方法。</p>
+
+<pre class="brush: js">var date = new Date(98, 1); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
+
+// 過時的方法,98 在這裡對應到 1998 年
+date.setYear(98); // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
+
+date.setFullYear(98); // Sat Feb 01 0098 00:00:00 GMT+0000 (BST)
+</pre>
+
+<h3 id="計算執行時間">計算執行時間</h3>
+
+<p>下面的例子展示如何使用兩個 Date 物件來求得執行程式所花費毫秒數。</p>
+
+<p>由於日(在夏令時轉換時)、月及年的長度並非固定,如果表示經過時間採用時、分、秒以外的單位,需要對這些差異作深入的研究,以處理可能發生的問題。</p>
+
+<pre class="brush: js">// 使用 Date 物件
+var start = Date.now();
+
+// 要計算執行時間的程式放在這裡
+doSomethingForALongTime();
+var end = Date.now();
+var elapsed = end - start; // 執行程式經過的毫秒數
+</pre>
+
+<pre class="brush: js">// 使用內建方法
+var start = new Date();
+
+// 要計算執行時間的程式放在這裡
+doSomethingForALongTime();
+var end = new Date();
+var elapsed = end.getTime() - start.getTime(); // 執行程式經過的毫秒數
+</pre>
+
+<pre class="brush: js">// 測試一個函數執行時間,並返回其回傳值
+function printElapsedTime(fTest) {
+ var nStartTime = Date.now(),
+ vReturn = fTest(),
+ nEndTime = Date.now();
+
+ console.log('Elapsed time: ' + String(nEndTime - nStartTime) + ' milliseconds');
+ return vReturn;
+}
+
+yourFunctionReturn = printElapsedTime(yourFunction);
+</pre>
+
+<div class="note">
+<p><strong>附註:</strong>在瀏覽器支援 {{domxref("window.performance", "Web Performance API", "", 1)}} 高精度特性下, {{domxref("Performance.now()")}} 可以提供比 {{jsxref("Date.now()")}} 更可靠、精確的執行時間測試結果。</p>
+</div>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date-objects', 'Date')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date-objects', 'Date')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9', 'Date')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初步定義。實作在 JavaScript 1.1。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>
+ <p>基本支援</p>
+ </td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}} [2]</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>
+ <p>基本支援</p>
+ </td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] 一些瀏覽器在解析日期時間會發生問題: <a href="http://dygraphs.com/date-formats.html">3/14/2012 blog from danvk Comparing FF/IE/Chrome on Parsing Date Strings</a></p>
+
+<p>[2] <a href="https://msdn.microsoft.com/en-us//library/ie/ff743760(v=vs.94).aspx">ISO8601 Date Format is not supported</a> in Internet Explorer 8, and other version can have <a href="http://dygraphs.com/date-formats.html">issues when parsing dates</a></p>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html
new file mode 100644
index 0000000000..00b4842f0f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/date/now/index.html
@@ -0,0 +1,123 @@
+---
+title: Date.now()
+slug: Web/JavaScript/Reference/Global_Objects/Date/now
+tags:
+ - Date
+ - JavaScript
+ - 參考
+ - 方法
+ - 方法補完
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/now
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Date.now()</code></strong> 方法回傳自 1970/01/01 00:00:00 UTC 起經過的毫秒數。</p>
+
+<h2 id="格式">格式</h2>
+
+<pre class="syntaxbox"><code>var timeInMs = Date.now();</code></pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個代表由經 UNIX 紀元起經過的毫秒數值({{jsxref("Number")}})。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>由於 <code>now()</code> 是 {{jsxref("Date")}} 的靜態方法,你只能用 <code>Date.now()</code> 的方式呼叫它。</p>
+
+<h2 id="補完">補完</h2>
+
+<p>這個函數是 ECMA-262 第 5 版的標準。 對於未更新支援此方法的引擎,可以利用底下的程式補上:</p>
+
+<pre class="brush: js">if (!Date.now) {
+ Date.now = function now() {
+ return new Date().getTime();
+ };
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9.4.4', 'Date.now')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初始定義,實作在 JavaScript 1.5 。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.now', 'Date.now')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date.now', 'Date.now')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatGeckoDesktop("1.9")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("10.50")}}</td>
+ <td>{{CompatSafari("4")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相關資源">相關資源</h2>
+
+<ul>
+ <li>{{domxref("Performance.now()")}} — 提供亞毫秒級的時間戳記,作為評估網頁效能的解決方案。</li>
+ <li>{{domxref("console.time()")}} / {{domxref("console.timeEnd()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html
new file mode 100644
index 0000000000..edd6a3fb47
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html
@@ -0,0 +1,245 @@
+---
+title: Date.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Date/prototype
+tags:
+ - Date
+ - JavaScript
+ - 原型
+ - 參考資料
+ - 屬性
+translation_of: Web/JavaScript/Reference/Global_Objects/Date
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Date.prototype</code></strong> 屬性表示 {{jsxref("Date")}} 建構子的原型。</p>
+
+<div>{{js_property_attributes(0, 0, 1)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p>JavaScript {{jsxref("Date")}} 實體繼承自 <code>Date.prototype。你可以藉由改變建構子的原型物件,來影響所有繼承自</code> JavaScript {{jsxref("Date")}} 的實體。</p>
+
+<p>為了千年年份(換個說法,考慮現在已到了 2000 年)的相容性,設定上你應該採用完整的年份。舉例來說,使用 1998 而不是 98 。為了讓你能取得完整的年份資料, Javascript 包含了 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} , {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} , {{jsxref("Date.prototype.getUTCFullYear()", "getUTCFullYear()")}} 以及 {{jsxref("Date.prototype.setUTCFullYear()", "setUTCFullYear()")}} 方法。</p>
+
+<p>自 ECMAScript 6 開始, <code>Date.prototype</code> 物件只是個一般物件,而不是一個 {{jsxref("Date")}} 實體。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Date.prototype.constructor</code></dt>
+ <dd>回傳一個能建立實體的函數,這是 {{jsxref("Date")}} 預設的建構子。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<h3 id="Getter">Getter</h3>
+
+<dl>
+ <dt>{{jsxref("Date.prototype.getDate()")}}</dt>
+ <dd>回傳本地時間月份中的日期(1-31)。</dd>
+ <dt>{{jsxref("Date.prototype.getDay()")}}</dt>
+ <dd>回傳本地時間星期中的日子(0-6)。</dd>
+ <dt>{{jsxref("Date.prototype.getFullYear()")}}</dt>
+ <dd>回傳本地時間的年份( 以 4 位數表現)。</dd>
+ <dt>{{jsxref("Date.prototype.getHours()")}}</dt>
+ <dd>回傳本地時間的小時(0-23)。</dd>
+ <dt>{{jsxref("Date.prototype.getMilliseconds()")}}</dt>
+ <dd>回傳本地時間的毫秒數(0-999)。</dd>
+ <dt>{{jsxref("Date.prototype.getMinutes()")}}</dt>
+ <dd>回傳本地時間的分鐘數(0-59)。</dd>
+ <dt>{{jsxref("Date.prototype.getMonth()")}}</dt>
+ <dd>回傳本地時間的月份(0-11)。</dd>
+ <dt>{{jsxref("Date.prototype.getSeconds()")}}</dt>
+ <dd>回傳本地時間的秒數(0-59)。</dd>
+ <dt>{{jsxref("Date.prototype.getTime()")}}</dt>
+ <dd>回傳由 1970-01-01 00:00:00 UTC 開始,到代表時間經過的毫秒數(以負值表示 1970 年之前的時間)。</dd>
+ <dt>{{jsxref("Date.prototype.getTimezoneOffset()")}}</dt>
+ <dd>回傳本地時差為多少分鐘。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCDate()")}}</dt>
+ <dd>回傳標準時間的在月份中的日期(1-31)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCDay()")}}</dt>
+ <dd>回傳標準時間在星期中的日子(0-6)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCFullYear()")}}</dt>
+ <dd>回傳標準時間的年份( 以 4 位數表現)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCHours()")}}</dt>
+ <dd>回傳標準時間的小時數(0-23)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</dt>
+ <dd>回傳標準時間裡的毫秒數(0-999)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCMinutes()")}}</dt>
+ <dd>回傳標準時間的分鐘數(0-59)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCMonth()")}}</dt>
+ <dd>回傳標準時間的月份數(0-11)。</dd>
+ <dt>{{jsxref("Date.prototype.getUTCSeconds()")}}</dt>
+ <dd>回傳標準時間的秒數(0-59)。</dd>
+ <dt>{{jsxref("Date.prototype.getYear()")}} {{deprecated_inline}}</dt>
+ <dd>回本地時間的年份(通常 2-3 位數)。用 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} 取代。</dd>
+</dl>
+
+<h3 id="Setter">Setter</h3>
+
+<dl>
+ <dt>{{jsxref("Date.prototype.setDate()")}}</dt>
+ <dd>設定本地時間月份中的日期。</dd>
+ <dt>{{jsxref("Date.prototype.setFullYear()")}}</dt>
+ <dd>設定本地時間的完整年份(以 4 位數表達 4 位數年份)。</dd>
+ <dt>{{jsxref("Date.prototype.setHours()")}}</dt>
+ <dd>設定本地時間的小時數。</dd>
+ <dt>{{jsxref("Date.prototype.setMilliseconds()")}}</dt>
+ <dd>設定本地時間的毫秒數。</dd>
+ <dt>{{jsxref("Date.prototype.setMinutes()")}}</dt>
+ <dd>設定本地時間的分鐘數。</dd>
+ <dt>{{jsxref("Date.prototype.setMonth()")}}</dt>
+ <dd>設定本地時間的月份。</dd>
+ <dt>{{jsxref("Date.prototype.setSeconds()")}}</dt>
+ <dd>設定本地時間的秒數。</dd>
+ <dt>{{jsxref("Date.prototype.setTime()")}}</dt>
+ <dd>設定這個 {{jsxref("Date")}} 物件距 1970-01-01 00:00:00 UTC 的毫秒數,允許使用負值表示之前的時間。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCDate()")}}</dt>
+ <dd>設定標準時間月份中的日期。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCFullYear()")}}</dt>
+ <dd>設定標準時間的完整年份(以 4 位數表示 4 位數年分)。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCHours()")}}</dt>
+ <dd>設定標準時間的小時數。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCMilliseconds()")}}</dt>
+ <dd>設定標準時間的毫秒數。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCMinutes()")}}</dt>
+ <dd>設定標準時間的分鐘數。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCMonth()")}}</dt>
+ <dd>設定標準時間的月份數。</dd>
+ <dt>{{jsxref("Date.prototype.setUTCSeconds()")}}</dt>
+ <dd>設定標準時間的秒數。</dd>
+ <dt>{{jsxref("Date.prototype.setYear()")}} {{deprecated_inline}}</dt>
+ <dd>設定本地時間的年份(使用 2-3 位數)。使用 {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} 取代。</dd>
+</dl>
+
+<h3 id="Conversion_getter">Conversion getter</h3>
+
+<dl>
+ <dt>{{jsxref("Date.prototype.toDateString()")}}</dt>
+ <dd>以可閱讀的字串型式,回傳 {{jsxref("Date")}} 的部分資訊。</dd>
+ <dt>{{jsxref("Date.prototype.toISOString()")}}</dt>
+ <dd>將日期時間轉換成 ISO 8601 格式的字串回傳。</dd>
+ <dt>{{jsxref("Date.prototype.toJSON()")}}</dt>
+ <dd>回傳等義於 {{jsxref("Date")}} 物件使用 {{jsxref("Date.prototype.toISOString()", "toISOString()")}} 方法的結果。特別使用 {{jsxref("JSON.stringify()")}} 處理。</dd>
+ <dt>{{jsxref("Date.prototype.toGMTString()")}} {{deprecated_inline}}</dt>
+ <dd>回傳 {{jsxref("Date")}} 以 GMT (UT) 時區基準代表的時間字串。使用 {{jsxref("Date.prototype.toUTCString()", "toUTCString()")}} 方法來取代。</dd>
+ <dt>{{jsxref("Date.prototype.toLocaleDateString()")}}</dt>
+ <dd>依照系統的時間地區設定,回傳日期字串。</dd>
+ <dt>{{jsxref("Date.prototype.toLocaleFormat()")}} {{non-standard_inline}}</dt>
+ <dd>傳入格式化字串參數,將日期時間轉換成指定格式的字串。</dd>
+ <dt>{{jsxref("Date.prototype.toLocaleString()")}}</dt>
+ <dd>回傳依系統的地區設定導出的日期時間字串。覆寫自 {{jsxref("Object.prototype.toLocaleString()")}} 方法。</dd>
+ <dt>{{jsxref("Date.prototype.toLocaleTimeString()")}}</dt>
+ <dd>回傳依系統的地區設定導出的時間字串。</dd>
+ <dt>{{jsxref("Date.prototype.toSource()")}} {{non-standard_inline}}</dt>
+ <dd>回傳一個建立相同 {{jsxref("Date")}} 物件的程式碼字串;你可以拿這個結果來建立新物件。覆寫自 {{jsxref("Object.prototype.toSource()")}} 方法。</dd>
+ <dt>{{jsxref("Date.prototype.toString()")}}</dt>
+ <dd>回傳代表此 {{jsxref("Date")}} 物件的字串。覆寫自 {{jsxref("Object.prototype.toString()")}} 方法。</dd>
+ <dt>{{jsxref("Date.prototype.toTimeString()")}}</dt>
+ <dd>以人類可讀的格式,回傳時間部分的字串。</dd>
+ <dt>{{jsxref("Date.prototype.toUTCString()")}}</dt>
+ <dd>依 UTC 時區,轉換出時間日期字串。</dd>
+ <dt>{{jsxref("Date.prototype.valueOf()")}}</dt>
+ <dd>回傳 {{jsxref("Date")}} 物件的原始數值。覆寫自 {{jsxref("Object.prototype.valueOf()")}} 方法。</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初步定義。實作在 JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9.5', 'Date.prototype')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>一般物件</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("41")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>一般物件</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("41")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html
new file mode 100644
index 0000000000..60f1c555f0
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/date/utc/index.html
@@ -0,0 +1,157 @@
+---
+title: Date.UTC()
+slug: Web/JavaScript/Reference/Global_Objects/Date/UTC
+tags:
+ - Date
+ - JavaScript
+ - 參考
+ - 方法
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/UTC
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Date.UTC()</code></strong> 方法接受與建構子相同長度的參數,將參數視為通用時間(UTC)來計算回傳由 1970-01-01 00:00:00 UTC 所經過的毫秒數。</p>
+
+<h2 id="格式">格式</h2>
+
+<pre class="syntaxbox"><code>Date.UTC(<var>year</var>, <var>month</var>[, <var>day</var>[, <var>hour</var>[, <var>minute</var>[, <var>second</var>[, <var>millisecond</var>]]]]])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>year</code></dt>
+ <dd>1900 年後的年份。</dd>
+ <dt><code>month</code></dt>
+ <dd>月份,介於 0 到 11 之間。</dd>
+ <dt><code>day</code></dt>
+ <dd>選用。月份中的日期,介於  1 到 31 之間。</dd>
+ <dt><code>hour</code></dt>
+ <dd>選用。小時,介於 0 到 23 之間。</dd>
+ <dt><code>minute</code></dt>
+ <dd>選用。分鐘數,介於 0 到 59 之間。</dd>
+ <dt><code>second</code></dt>
+ <dd>選用。秒數,介於 0 到 59 之間。</dd>
+ <dt><code>millisecond</code></dt>
+ <dd>選用。毫秒數 0 到 999 之間。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>得到傳入這個 {{jsxref("Date")}} 方法的參數所代表時間,與 1970-01-01 00:00:00 UTC 相差的毫秒數。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>UTC()</code> 取得以逗號分隔的時間參數,回傳 1970-01-01 00:00:00 UTC 與該時間相差的毫秒數。</p>
+
+<p>你應該指定完成的年份資料,例如: 1998。如果一個 0 到 99 的年份被指定,這個方法會將它轉換為 20 世紀的年份(變為 19xx 年),例如你傳入 95 ,則會被當作 1995 年被指定。</p>
+
+<p>這個 <code>UTC()</code> 方法與 {{jsxref("Date")}} 建構子有兩個地方不同。</p>
+
+<ul>
+ <li><code>Date.UTC()</code> 使用 UTC 時區而不是當地時區。</li>
+ <li><code>Date.UTC()</code> 回傳一個數值而不是 {{jsxref("Date")}} 物件。</li>
+</ul>
+
+<p>當你指定參數超出預期的範圍, UTC( ) 方法會去調整其它的參數使之成立。比如如果你指定月份為 15 ,年份將被加 1 ,以 3 作為傳入的月份。</p>
+
+<p>因為 UTC( ) 是 {{jsxref("Date")}} 的一個靜態方法,只能使用 <code>Date.UTC() 的方式呼叫,而不能由建立出來的 </code>{{jsxref("Date")}} 物件去執行它。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Date.UTC()">使用 <code>Date.UTC()</code></h3>
+
+<p>以下利用它來將指定的時間以 UTC 而非本地時間的方式來建立  {{jsxref("Date")}} 物件:</p>
+
+<pre class="brush:js">var utcDate = new Date(Date.UTC(96, 11, 1, 0, 0, 0));
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date.utc', 'Date.UTC')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.utc', 'Date.UTC')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.9.4.3', 'Date.UTC')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義。<br>
+ 實作在 JavaScript 1.0.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>平台</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相關資源">相關資源</h2>
+
+<ul>
+ <li>{{jsxref("Date.parse()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html b/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html
new file mode 100644
index 0000000000..1db87220e8
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/error/columnnumber/index.html
@@ -0,0 +1,81 @@
+---
+title: Error.prototype.columnNumber
+slug: Web/JavaScript/Reference/Global_Objects/Error/columnNumber
+translation_of: Web/JavaScript/Reference/Global_Objects/Error/columnNumber
+---
+<div>{{JSRef}} {{non-standard_header}}</div>
+
+<p>「行數」屬性含括了檔案中引起錯誤的所在行數。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_columnNumber">使用 <code>columnNumber</code></h3>
+
+<pre class="brush: js">var e = new Error('Could not parse input');
+throw e;
+console.log(e.columnNumber) // 0
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<p>不是任何規格的一部份,尚未標準化。</p>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Error.prototype.stack")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("Error.prototype.lineNumber")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("Error.prototype.fileName")}} {{non-standard_inline}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/error/index.html b/files/zh-tw/web/javascript/reference/global_objects/error/index.html
new file mode 100644
index 0000000000..623a5dfeac
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/error/index.html
@@ -0,0 +1,233 @@
+---
+title: Error
+slug: Web/JavaScript/Reference/Global_Objects/Error
+tags:
+ - Error
+ - JavaScript
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/Error
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Error</code></strong> 建構函式能用來建立一個 error 物件。當執行期間發生錯誤時,<code>Error</code> 物件實體會被拋出。<code>Error</code> 物件也可作為自訂例外的基礎物件,請參考下方的標準內建錯誤類型。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new Error([<var>message</var>[, <var>fileName</var>[, <var>lineNumber</var>]]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>message</code> {{optional_inline}}</dt>
+ <dd>人們可閱讀的錯誤說明。</dd>
+ <dt><code>fileName</code> {{optional_inline}} {{non-standard_inline}}</dt>
+ <dd>The value for the <code>fileName</code> property on the created <code>Error</code> object. Defaults to the name of the file containing the code that called the <code>Error()</code> constructor.</dd>
+ <dt><code>lineNumber</code> {{optional_inline}} {{non-standard_inline}}</dt>
+ <dd>Optional. The value for the <code>lineNumber</code> property on the created <code>Error</code> object. Defaults to the line number containing the <code>Error()</code> constructor invocation.</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>Runtime errors result in new <code>Error</code> objects being created and thrown.</p>
+
+<p>This page documents the use of the <code>Error</code> object itself and its use as a constructor function. For a list of properties and methods inherited by <code>Error</code> instances, see {{jsxref("Error.prototype")}}.</p>
+
+<h3 id="錯誤類型">錯誤類型</h3>
+
+<p>Besides the generic <code>Error</code> constructor, there are six other core error constructors in JavaScript. For client-side exceptions, see <a href="/en-US/docs/Web/JavaScript/Guide/Statements#Exception_Handling_Statements">Exception Handling Statements</a>.</p>
+
+<dl>
+ <dt>{{jsxref("EvalError")}}</dt>
+ <dd>Creates an instance representing an error that occurs regarding the global function {{jsxref("Global_Objects/eval", "eval()")}}.</dd>
+ <dt>{{jsxref("InternalError")}} {{non-standard_inline}}</dt>
+ <dd>Creates an instance representing an error that occurs when an internal error in the JavaScript engine is thrown. E.g. "too much recursion".</dd>
+ <dt>{{jsxref("RangeError")}}</dt>
+ <dd>Creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid range.</dd>
+ <dt>{{jsxref("ReferenceError")}}</dt>
+ <dd>Creates an instance representing an error that occurs when de-referencing an invalid reference.</dd>
+ <dt>{{jsxref("SyntaxError")}}</dt>
+ <dd>Creates an instance representing a syntax error that occurs while parsing code in {{jsxref("Global_Objects/eval", "eval()")}}.</dd>
+ <dt>{{jsxref("TypeError")}}</dt>
+ <dd>Creates an instance representing an error that occurs when a variable or parameter is not of a valid type.</dd>
+ <dt>{{jsxref("URIError")}}</dt>
+ <dd>Creates an instance representing an error that occurs when {{jsxref("Global_Objects/encodeURI", "encodeURI()")}} or {{jsxref("Global_Objects/decodeURI", "decodeURI()")}} are passed invalid parameters.</dd>
+</dl>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Error.prototype")}}</dt>
+ <dd>Allows the addition of properties to <code>Error</code> instances.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>The global <code>Error</code> object contains no methods of its own, however, it does inherit some methods through the prototype chain.</p>
+
+<h2 id="Error_實體"><code>Error</code> 實體</h2>
+
+<div>{{page('en-US/docs/JavaScript/Reference/Global_Objects/Error/prototype', 'Description')}}</div>
+
+<h3 id="屬性_2">屬性</h3>
+
+<div>{{page('en-US/docs/JavaScript/Reference/Global_Objects/Error/prototype', 'Properties')}}</div>
+
+<h3 id="方法_2">方法</h3>
+
+<div>{{page('en-US/docs/JavaScript/Reference/Global_Objects/Error/prototype', 'Methods')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Throwing_a_generic_error">Throwing a generic error</h3>
+
+<p>Usually you create an <code>Error</code> object with the intention of raising it using the {{jsxref("Statements/throw", "throw")}} keyword. You can handle the error using the {{jsxref("Statements/try...catch", "try...catch")}} construct:</p>
+
+<pre class="brush: js">try {
+ throw new Error('Whoops!');
+} catch (e) {
+ console.log(e.name + ': ' + e.message);
+}
+</pre>
+
+<h3 id="Handling_a_specific_error">Handling a specific error</h3>
+
+<p>You can choose to handle only specific error types by testing the error type with the error's {{jsxref("Object.prototype.constructor", "constructor")}} property or, if you're writing for modern JavaScript engines, {{jsxref("Operators/instanceof", "instanceof")}} keyword:</p>
+
+<pre class="brush: js">try {
+ foo.bar();
+} catch (e) {
+ if (e instanceof EvalError) {
+ console.log(e.name + ': ' + e.message);
+ } else if (e instanceof RangeError) {
+ console.log(e.name + ': ' + e.message);
+ }
+ // ... etc
+}
+</pre>
+
+<h3 id="Custom_Error_Types">Custom Error Types</h3>
+
+<p>You might want to define your own error types deriving from <code>Error</code> to be able to <code>throw new MyError()</code> and use <code>instanceof MyError</code> to check the kind of error in the exception handler. The common way to do this is demonstrated below.</p>
+
+<div class="warning">
+<p>Note that the thrown <code>MyError</code> will report incorrect <code>lineNumber</code> and <code>fileName</code> at least in Firefox.</p>
+</div>
+
+<p>See also the <a href="http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript">"What's a good way to extend Error in JavaScript?" discussion on Stackoverflow</a>.</p>
+
+<pre class="brush: js">// Create a new object, that prototypically inherits from the Error constructor
+function MyError(message) {
+ this.name = 'MyError';
+ this.message = message || 'Default Message';
+ this.stack = (new Error()).stack;
+}
+MyError.prototype = Object.create(Error.prototype);
+MyError.prototype.constructor = MyError;
+
+try {
+ throw new MyError();
+} catch (e) {
+ console.log(e.name); // 'MyError'
+ console.log(e.message); // 'Default Message'
+}
+
+try {
+ throw new MyError('custom message');
+} catch (e) {
+ console.log(e.name); // 'MyError'
+ console.log(e.message); // 'custom message'
+}</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.11', 'Error')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-error-objects', 'Error')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-error-objects', 'Error')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Error.prototype")}}</li>
+ <li>{{jsxref("Statements/throw", "throw")}}</li>
+ <li>{{jsxref("Statements/try...catch", "try...catch")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html
new file mode 100644
index 0000000000..698d2f46fc
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/apply/index.html
@@ -0,0 +1,260 @@
+---
+title: Function.prototype.apply()
+slug: Web/JavaScript/Reference/Global_Objects/Function/apply
+translation_of: Web/JavaScript/Reference/Global_Objects/Function/apply
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>apply() </strong>方法會呼叫一個以 this 的代表值和一個陣列形式的值組(或是一個 </code><a href="/en-US/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects">array-like object</a> <code>)為參數的函式。</code></p>
+
+<div class="note">
+<p><strong>注意:</strong>這個函式的語法和{{jsxref("Function.call", "call()")}} 幾乎一樣,最大的不同是 <code>call()</code> 接受<code><strong>一連串的參數</strong></code>,而 <code>apply() 接受<strong>一組陣列形式的參數</strong>。</code></p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>fun</var>.apply(<var>thisArg, </var>[<var>argsArray</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>thisArg</code></dt>
+ <dd>讓 <em><code>fun </code></em><code>呼叫時</code>可以視為 this  的值。注意,這可能並不是最後會在方法裡看見的值:如果這是一個在非 {{jsxref("Strict_mode", "non-strict mode", "", 1)}} 下運作的程式碼,{{jsxref("null")}} 及 {{jsxref("undefined")}} 將會被全域物件取代,而原始類別將被封裝。</dd>
+ <dt><code>argsArray</code></dt>
+ <dd>一個 array-like object ,定義了 <em><code>fun </code></em><code>要呼叫的一組參數,如果沒有需要提供,可以傳入 </code>{{jsxref("null")}} 或 {{jsxref("undefined")}} 。從 ECMAScript 5 開始,這些參數不僅可以是泛型的 array-like object ,而不一定要是一組陣列。查看下方的{{anch("Browser_compatibility", "browser compatibility")}} 資訊。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>傳入 <code><strong>this </strong>值及一組參數後得到的結果。</code></p>
+
+<h2 id="描述">描述</h2>
+
+<p>在呼叫一個現存的函式時,你可以傳入不同的 <code>this 物件值。this 參考到現在的物件,也就是正在執行的物件。apply 讓你可以只寫一次方法後,讓其他物件也繼承到這個方法,而不用一再重寫。</code></p>
+
+<p><code>apply 與</code> {{jsxref("Function.call", "call()")}} 非常相似,不同的是支援的傳入參數類型。使用陣列形式的參數,而不是命名過的接收參數。使用 <code>apply 時,</code>你可以選擇使用陣列實字:<code><em>fun</em>.apply(this, ['eat', 'bananas']); 或是 </code>{{jsxref("Array")}} 物件: <code><em>fun</em>.apply(this, new Array('eat', 'bananas'))。</code></p>
+
+<p><code>除此之外,你也可以使用</code> {{jsxref("Functions/arguments", "arguments")}} 代表 <code>argsArray 參數。arguments 是在函式裡的區域變數,可用來存取所有沒有特別被所呼叫物件指定的傳入參數。因此,使用 apply 時你不需要知道所呼叫函式的指定參數。使用 </code>arguments 把所有參數傳入呼叫的方法裡,而被呼叫的方法會接手處理這些參數。</p>
+
+<p>從 ECMAScript 5th 版本後,也可以使用陣列形式的物件,在實踐上這代表他會擁有 <code>length 以及整數範圍 </code> <code>(0...length-1) 的屬性。舉例來說,你可以使用 </code>{{domxref("NodeList")}}  或是一個像這樣的自定義屬性: <code>{ 'length': 2, '0': 'eat', '1': 'bananas' }。</code></p>
+
+<div class="note">
+<p>一般瀏覽器,包括 Chrome 14 及 Internet Explorer 9,仍不支援陣列形式的物件,所以會對此丟出一個錯誤。</p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_apply_與建構子鏈結">使用 <code>apply</code> 與建構子鏈結</h3>
+
+<p>您可以使用 <code>apply</code> 鏈結 {{jsxref("Operators/new", "constructors", "", 1)}} 一個物件,與 Java 相似,如下範例中我們可以建立一個全域的 {{jsxref("Function")}} 方法叫 <code>construct</code>,使您可以使用類陣列的物件與建構子去替代參數列表。</p>
+
+<pre class="brush: js">Function.prototype.construct = function(aArgs) {
+  var oNew = Object.create(this.prototype);
+  this.apply(oNew, aArgs);
+  return oNew;
+};
+</pre>
+
+<div class="note">
+<p><strong>注意:</strong>如上範例的 <code>Object.create()</code> 方法是屬於比較新的寫法。如需使用閉包的替代方法,請參考以下的範例:</p>
+
+<pre class="brush: js">Function.prototype.construct = function(aArgs) {
+  var fConstructor = this, fNewConstr = function() {
+ fConstructor.apply(this, aArgs);
+ };
+  fNewConstr.prototype = fConstructor.prototype;
+  return new fNewConstr();
+};</pre>
+</div>
+
+<p>使用範例:</p>
+
+<pre class="brush: js">function MyConstructor() {
+ for (var nProp = 0; nProp &lt; arguments.length; nProp++) {
+ this['property' + nProp] = arguments[nProp];
+ }
+}
+
+var myArray = [4, 'Hello world!', false];
+var myInstance = MyConstructor.construct(myArray);
+
+console.log(myInstance.property1); // logs 'Hello world!'
+console.log(myInstance instanceof MyConstructor); // logs 'true'
+console.log(myInstance.constructor); // logs 'MyConstructor'
+</pre>
+
+<div class="note">
+<p><strong>注意:</strong>This non-native <code>Function.construct</code> method will not work with some native constructors (like {{jsxref("Date")}}, for example). In these cases you have to use the {{jsxref("Function.prototype.bind")}} method (for example, imagine having an array like the following, to be used with {{jsxref("Global_Objects/Date", "Date")}} constructor: <code>[2012, 11, 4]</code>; in this case you have to write something like: <code>new (Function.prototype.bind.apply(Date, [null].concat([2012, 11, 4])))()</code> — anyhow this is not the best way to do things and probably should not be used in any production environment).</p>
+</div>
+
+<h3 id="使用_apply_於內建的函數">使用 <code>apply</code> 於內建的函數</h3>
+
+<p>apply 可以巧妙的在某些任務中使用內建函數,否則可能會循環遍歷整個陣列來寫入。如下範例,我們使用 <code>Math.max/Math.min</code> 來找出陣列中最大/最小的值。</p>
+
+<pre class="brush: js">// min/max number in an array
+var numbers = [5, 6, 2, 3, 7];
+
+// using Math.min/Math.max apply
+var max = Math.max.apply(null, numbers);
+// This about equal to Math.max(numbers[0], ...)
+// or Math.max(5, 6, ...)
+
+var min = Math.min.apply(null, numbers);
+
+// vs. simple loop based algorithm
+max = -Infinity, min = +Infinity;
+
+for (var i = 0; i &lt; numbers.length; i++) {
+ if (numbers[i] &gt; max) {
+ max = numbers[i];
+ }
+ if (numbers[i] &lt; min) {
+ min = numbers[i];
+ }
+}
+</pre>
+
+<p>But beware: in using <code>apply</code> this way, you run the risk of exceeding the JavaScript engine's argument length limit. The consequences of applying a function with too many arguments (think more than tens of thousands of arguments) vary across engines (JavaScriptCore has hard-coded <a class="link-https" href="https://bugs.webkit.org/show_bug.cgi?id=80797">argument limit of 65536</a>), because the limit (indeed even the nature of any excessively-large-stack behavior) is unspecified. Some engines will throw an exception. More perniciously, others will arbitrarily limit the number of arguments actually passed to the applied function. (To illustrate this latter case: if such an engine had a limit of four arguments [actual limits are of course significantly higher], it would be as if the arguments <code>5, 6, 2, 3</code> had been passed to <code>apply</code> in the examples above, rather than the full array.) If your value array might grow into the tens of thousands, use a hybrid strategy: apply your function to chunks of the array at a time:</p>
+
+<pre class="brush: js">function minOfArray(arr) {
+ var min = Infinity;
+ var QUANTUM = 32768;
+
+ for (var i = 0, len = arr.length; i &lt; len; i += QUANTUM) {
+ var submin = Math.min.apply(null,
+ arr.slice(i, Math.min(i+QUANTUM, len)));
+ min = Math.min(submin, min);
+ }
+
+ return min;
+}
+
+var min = minOfArray([5, 6, 2, 3, 7]);
+</pre>
+
+<h3 id="Using_apply_in_monkey-patching">Using apply in "monkey-patching"</h3>
+
+<p>Apply can be the best way to monkey-patch a built-in function of Firefox, or JS libraries. Given <code>someobject.foo</code> function, you can modify the function in a somewhat hacky way, like so:</p>
+
+<pre class="brush: js">var originalfoo = someobject.foo;
+someobject.foo = function() {
+ // Do stuff before calling function
+ console.log(arguments);
+ // Call the function as it would have been called normally:
+ originalfoo.apply(this, arguments);
+ // Run stuff after, here.
+}
+</pre>
+
+<p>This method is especially handy where you want to debug events, or interface with something that has no API like the various <code>.on([event]...</code> events, such as those usable on the <a href="/en-US/docs/Tools/Page_Inspector#Developer_API">Devtools Inspector</a>).</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.3.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.3.4.3', 'Function.prototype.apply')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function.prototype.apply', 'Function.prototype.apply')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function.prototype.apply', 'Function.prototype.apply')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>ES 5.1 generic array-like object as {{jsxref("Functions/arguments", "arguments")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("2.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>ES 5.1 generic array-like object as {{jsxref("Functions/arguments", "arguments")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("2.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Functions/arguments", "arguments")}} object</li>
+ <li>{{jsxref("Function.prototype.bind()")}}</li>
+ <li>{{jsxref("Function.prototype.call()")}}</li>
+ <li>{{jsxref("Functions", "Functions and function scope", "", 1)}}</li>
+ <li>{{jsxref("Reflect.apply()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html
new file mode 100644
index 0000000000..7092477133
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/bind/index.html
@@ -0,0 +1,321 @@
+---
+title: Function.prototype.bind()
+slug: Web/JavaScript/Reference/Global_Objects/Function/bind
+translation_of: Web/JavaScript/Reference/Global_Objects/Function/bind
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>bind()</strong></code> 方法,會建立一個新函式。該函式被呼叫時,會將 <code>this</code> 關鍵字設為給定的參數,並在呼叫時,帶有提供之前,給定順序的參數。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>fun</var>.bind(<var>thisArg</var>[, <var>arg1</var>[, <var>arg2</var>[, ...]]])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>thisArg</code></dt>
+ <dd>The value to be passed as the <code>this</code> parameter to the target function when the bound function is called. The value is ignored if the bound function is constructed using the {{jsxref("Operators/new", "new")}} operator.</dd>
+ <dt><code>arg1, arg2, ...</code></dt>
+ <dd>Arguments to prepend to arguments provided to the bound function when invoking the target function.</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A copy of the given function with the specified <strong><code>this</code></strong> value and initial arguments.</p>
+
+<h2 id="敘述">敘述</h2>
+
+<p><strong>bind()</strong> 函式建立了一個新的<strong>綁定函式(BF)</strong>。<strong>BF</strong> 是個包裝了原有函式物件的 <strong>exotic function object</strong>(<strong>ECMAScript 2015</strong> 的術語)。通常,呼叫 <strong>BF</strong> 會執行該 <strong>wrapped function</strong>。<strong> BF</strong> 含有以下內部屬性:</p>
+
+<ul>
+ <li><strong>[[BoundTargetFunction]] </strong>- the wrapped function object;</li>
+ <li><strong>[[BoundThis]]</strong> - the value that is always passed as <strong>this</strong> value when calling the wrapped function.</li>
+ <li><strong>[[BoundArguments]]</strong> - a list of values whose elements are used as the first arguments to any call to the wrapped function.</li>
+ <li><strong>[[Call]]</strong> - executes code associated with this object. Invoked via a function call expression. The arguments to the internal method are a <strong>this</strong> value and a list containing the arguments passed to the function by a call expression.</li>
+</ul>
+
+<p>When bound function is called, it calls internal method<strong> [[Call]]</strong> on <strong>[[BoundTargetFunction]], </strong>with following arguments <strong>Call(<em>boundThis</em>, <em>args</em>).</strong> Where, <strong><em>boundThis </em></strong>is <strong>[[BoundThis]]</strong>, <em><strong>args </strong></em>is <strong>[[BoundArguments]]</strong> followed by the arguments passed by the function call.</p>
+
+<p>A bound function may also be constructed using the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/new" title="The new operator creates an instance of a user-defined object type or of one of the built-in object types that has a constructor function."><code>new</code></a> operator: doing so acts as though the target function had instead been constructed. The provided <strong><code>this</code></strong> value is ignored, while prepended arguments are provided to the emulated function.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="建立綁定函式">建立綁定函式</h3>
+
+<p>The simplest use of <code>bind()</code> is to make a function that, no matter how it is called, is called with a particular <strong><code>this</code></strong> value. A common mistake for new JavaScript programmers is to extract a method from an object, then to later call that function and expect it to use the original object as its <code>this</code> (e.g. by using that method in callback-based code). Without special care, however, the original object is usually lost. Creating a bound function from the function, using the original object, neatly solves this problem:</p>
+
+<pre class="brush: js">this.x = 9; // this refers to global "window" object here in the browser
+var module = {
+ x: 81,
+ getX: function() { return this.x; }
+};
+
+module.getX(); // 81
+
+var retrieveX = module.getX;
+retrieveX();
+// returns 9 - The function gets invoked at the global scope
+
+// Create a new function with 'this' bound to module
+// New programmers might confuse the
+// global var x with module's property x
+var boundGetX = retrieveX.bind(module);
+boundGetX(); // 81
+</pre>
+
+<h3 id="Partially_applied_functions">Partially applied functions</h3>
+
+<p>The next simplest use of <code>bind()</code> is to make a function with pre-specified initial arguments. These arguments (if any) follow the provided <code>this</code> value and are then inserted at the start of the arguments passed to the target function, followed by the arguments passed to the bound function, whenever the bound function is called.</p>
+
+<pre class="brush: js">function list() {
+ return Array.prototype.slice.call(arguments);
+}
+
+var list1 = list(1, 2, 3); // [1, 2, 3]
+
+// Create a function with a preset leading argument
+var leadingThirtysevenList = list.bind(null, 37);
+
+var list2 = leadingThirtysevenList();
+// [37]
+
+var list3 = leadingThirtysevenList(1, 2, 3);
+// [37, 1, 2, 3]
+</pre>
+
+<h3 id="配合_setTimeout">配合 <code>setTimeout</code></h3>
+
+<p>By default within {{domxref("window.setTimeout()")}}, the <code>this</code> keyword will be set to the {{ domxref("window") }} (or <code>global</code>) object. When working with class methods that require <code>this</code> to refer to class instances, you may explicitly bind <code>this</code> to the callback function, in order to maintain the instance.</p>
+
+<pre class="brush: js">function LateBloomer() {
+ this.petalCount = Math.floor(Math.random() * 12) + 1;
+}
+
+// Declare bloom after a delay of 1 second
+LateBloomer.prototype.bloom = function() {
+ window.setTimeout(this.declare.bind(this), 1000);
+};
+
+LateBloomer.prototype.declare = function() {
+ console.log('I am a beautiful flower with ' +
+ this.petalCount + ' petals!');
+};
+
+var flower = new LateBloomer();
+flower.bloom();
+// after 1 second, triggers the 'declare' method</pre>
+
+<h3 id="Bound_functions_used_as_constructors">Bound functions used as constructors</h3>
+
+<div class="warning">
+<p><strong>Warning:</strong> This section demonstrates JavaScript capabilities and documents some edge cases of the <code>bind()</code> method. The methods shown below are not the best way to do things and probably should not be used in any production environment.</p>
+</div>
+
+<p>Bound functions are automatically suitable for use with the {{jsxref("Operators/new", "new")}} operator to construct new instances created by the target function. When a bound function is used to construct a value, the provided <code>this</code> is ignored. However, provided arguments are still prepended to the constructor call:</p>
+
+<pre class="brush: js">function Point(x, y) {
+ this.x = x;
+ this.y = y;
+}
+
+Point.prototype.toString = function() {
+ return this.x + ',' + this.y;
+};
+
+var p = new Point(1, 2);
+p.toString(); // '1,2'
+
+// not supported in the polyfill below,
+
+// works fine with native bind:
+
+var YAxisPoint = Point.bind(null, 0/*x*/);
+
+
+var emptyObj = {};
+var YAxisPoint = Point.bind(emptyObj, 0/*x*/);
+
+var axisPoint = new YAxisPoint(5);
+axisPoint.toString(); // '0,5'
+
+axisPoint instanceof Point; // true
+axisPoint instanceof YAxisPoint; // true
+new Point(17, 42) instanceof YAxisPoint; // true
+</pre>
+
+<p>Note that you need do nothing special to create a bound function for use with {{jsxref("Operators/new", "new")}}. The corollary is that you need do nothing special to create a bound function to be called plainly, even if you would rather require the bound function to only be called using {{jsxref("Operators/new", "new")}}.</p>
+
+<pre class="brush: js">// Example can be run directly in your JavaScript console
+// ...continuing from above
+
+// Can still be called as a normal function
+// (although usually this is undesired)
+YAxisPoint(13);
+
+emptyObj.x + ',' + emptyObj.y;
+// &gt; '0,13'
+</pre>
+
+<p>If you wish to support the use of a bound function only using {{jsxref("Operators/new", "new")}}, or only by calling it, the target function must enforce that restriction.</p>
+
+<h3 id="Creating_shortcuts">Creating shortcuts</h3>
+
+<p><code>bind()</code> is also helpful in cases where you want to create a shortcut to a function which requires a specific <strong><code>this</code></strong> value.</p>
+
+<p>Take {{jsxref("Array.prototype.slice")}}, for example, which you want to use for converting an array-like object to a real array. You could create a shortcut like this:</p>
+
+<pre class="brush: js">var slice = Array.prototype.slice;
+
+// ...
+
+slice.apply(arguments);
+</pre>
+
+<p>With <code>bind()</code>, this can be simplified. In the following piece of code, <code>slice</code> is a bound function to the {{jsxref("Function.prototype.apply()", "apply()")}} function of {{jsxref("Function.prototype")}}, with the <strong><code>this</code></strong> value set to the {{jsxref("Array.prototype.slice()", "slice()")}} function of {{jsxref("Array.prototype")}}. This means that additional <code>apply()</code> calls can be eliminated:</p>
+
+<pre class="brush: js">// same as "slice" in the previous example
+var unboundSlice = Array.prototype.slice;
+var slice = Function.prototype.apply.bind(unboundSlice);
+
+// ...
+
+slice(arguments);
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>You can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of <code>bind()</code> in implementations that do not natively support it.</p>
+
+<pre class="brush: js">if (!Function.prototype.bind) {
+ Function.prototype.bind = function(oThis) {
+ if (typeof this !== 'function') {
+ // closest thing possible to the ECMAScript 5
+ // internal IsCallable function
+ throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
+ }
+
+ var aArgs = Array.prototype.slice.call(arguments, 1),
+ fToBind = this,
+ fNOP = function() {},
+ fBound = function() {
+ return fToBind.apply(this instanceof fNOP
+ ? this
+ : oThis,
+ aArgs.concat(Array.prototype.slice.call(arguments)));
+ };
+
+ if (this.prototype) {
+ // Function.prototype doesn't have a prototype property
+ fNOP.prototype = this.prototype;
+ }
+ fBound.prototype = new fNOP();
+
+ return fBound;
+ };
+}
+</pre>
+
+<p>Some of the many differences (there may well be others, as this list does not seriously attempt to be exhaustive) between this algorithm and the specified algorithm are:</p>
+
+<ul>
+ <li>The partial implementation relies on {{jsxref("Array.prototype.slice()")}}, {{jsxref("Array.prototype.concat()")}}, {{jsxref("Function.prototype.call()")}} and {{jsxref("Function.prototype.apply()")}}, built-in methods to have their original values.</li>
+ <li>The partial implementation creates functions that do not have immutable "poison pill" {{jsxref("Function.caller", "caller")}} and <code>arguments</code> properties that throw a {{jsxref("Global_Objects/TypeError", "TypeError")}} upon get, set, or deletion. (This could be added if the implementation supports {{jsxref("Object.defineProperty")}}, or partially implemented [without throw-on-delete behavior] if the implementation supports the {{jsxref("Object.defineGetter", "__defineGetter__")}} and {{jsxref("Object.defineSetter", "__defineSetter__")}} extensions.)</li>
+ <li>The partial implementation creates functions that have a <code>prototype</code> property. (Proper bound functions have none.)</li>
+ <li>The partial implementation creates bound functions whose {{jsxref("Function.length", "length")}} property does not agree with that mandated by ECMA-262: it creates functions with length 0, while a full implementation, depending on the length of the target function and the number of pre-specified arguments, may return a non-zero length.</li>
+</ul>
+
+<p>If you choose to use this partial implementation, <strong>you must not rely on those cases where behavior deviates from ECMA-262, 5th edition!</strong> With some care, however (and perhaps with additional modification to suit specific needs), this partial implementation may be a reasonable bridge to the time when <code>bind()</code> is widely implemented according to the specification.</p>
+
+<p>Please check <a href="https://github.com/Raynos/function-bind">https://github.com/Raynos/function-bind</a> for a more thorough solution!</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.3.4.5', 'Function.prototype.bind')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-function.prototype.bind', 'Function.prototype.bind')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function.prototype.bind', 'Function.prototype.bind')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("7")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("2")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("11.60")}}</td>
+ <td>{{CompatSafari("5.1")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatAndroid("4.0")}}</td>
+ <td>{{CompatChrome("1")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("2")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOperaMobile("11.5")}}</td>
+ <td>{{CompatSafari("6.0")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相關連結">相關連結</h2>
+
+<ul>
+ <li>{{jsxref("Function.prototype.apply()")}}</li>
+ <li>{{jsxref("Function.prototype.call()")}}</li>
+ <li>{{jsxref("Functions", "Functions", "", 1)}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html
new file mode 100644
index 0000000000..1d1d2017ee
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/call/index.html
@@ -0,0 +1,105 @@
+---
+title: Function.prototype.call
+slug: Web/JavaScript/Reference/Global_Objects/Function/call
+translation_of: Web/JavaScript/Reference/Global_Objects/Function/call
+---
+<p>{{JSRef}}</p>
+
+<h2 id="概述">概述</h2>
+
+<p>使用給定的<code>this</code>參數以及分別給定的參數來呼叫某個函數</p>
+
+<div class="note"><strong>附註:</strong> 此函數的所有語法大致上與<code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply">apply()</a></code>相同,他們基本上不同處只有 <code>call()</code> 接受一連串的參數,而 <code>apply()</code> 單一的array作為參數</div>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th class="header" colspan="2"><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function">Function </a>物件的方法</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>被實作於</td>
+ <td>JavaScript 1.3</td>
+ </tr>
+ <tr>
+ <td>ECMAScript 版本</td>
+ <td>ECMAScript 第三版</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><em>fun</em>.call(<em>thisArg</em>[, <em>arg1</em>[, <em>arg2</em>[, ...]]])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>thisArg</code></dt>
+ <dd>呼叫<em><code>fun</code></em>時提供的<code>this</code>值。 注意,它可能是一個無法在函數內看到的值:若這個函數是在非嚴苛模式( <a href="/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="JavaScript/Strict mode">non-strict mode</a> ), <code>null</code> <code>、undefined</code> 將會被置換成全域變數,而原生型態的值將會被封裝</dd>
+ <dt><code>arg1, arg2, ...</code></dt>
+ <dd>其他參數</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>你可以在呼叫一個現存的函數時,使用不一樣的 <code>this</code> 物件。 <code>this</code> 會參照到目前的物件,呼叫的物件上</p>
+
+<p>使用 <code>call,</code> 你可以實作函數一次,然後在其他的物件上直接繼承它,而不用在新的物件上重寫該函數</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_call_來串接物件上的建構子">使用 <code>call</code> 來串接物件上的建構子</h3>
+
+<p>你可以使用 <code>call</code> 來串接其他物件的建構子,就像 Java. 下面的例子中,<code>Product</code> 物件的建構子定義了兩個參數 <code>name</code> 以及 <code>price</code>. 其他函數<code>Food</code> 及 <code>Toy</code> 引用了 <code>Product</code> 並傳入 <code>this</code> 、 <code>name</code> 和 <code>price</code>。 Product 初始化它的屬性 <code>name</code> 和 <code>price</code>, 而兩個子函數則定義了<code>category。</code></p>
+
+<pre class="brush: js">function Product(name, price) {
+ this.name = name;
+ this.price = price;
+
+ if (price &lt; 0)
+ throw RangeError('Cannot create product "' + name + '" with a negative price');
+ return this;
+}
+
+function Food(name, price) {
+ Product.call(this, name, price);
+ this.category = 'food';
+}
+Food.prototype = new Product();
+
+function Toy(name, price) {
+ Product.call(this, name, price);
+ this.category = 'toy';
+}
+Toy.prototype = new Product();
+
+var cheese = new Food('feta', 5);
+var fun = new Toy('robot', 40);
+</pre>
+
+<h3 id="使用_call_來呼叫匿名的函數">使用 <code>call</code> 來呼叫匿名的函數</h3>
+
+<p>下面這個簡易的例子中,我們做了一個匿名的函數,並用 <code>call</code> 來讓它應用在每個在串列中的物件中. 這個匿名函數的主要用途是加入一個print函數到每個物件上,這個函數可以印出每個物件的index指標。 傳入物件作為 <code>this</code> 的值並不是必要的,但他有解釋的用途。</p>
+
+<pre class="brush: js">var animals = [
+ {species: 'Lion', name: 'King'},
+ {species: 'Whale', name: 'Fail'}
+];
+
+for (var i = 0; i &lt; animals.length; i++) {
+ (function (i) {
+ this.print = function () {
+ console.log('#' + i + ' ' + this.species + ': ' + this.name);
+ }
+ this.print();
+ }).call(animals[i], i);
+}
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply" title="JavaScript/Reference/Global_Objects/Function/apply">apply</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/index.html
new file mode 100644
index 0000000000..b88c087b24
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/index.html
@@ -0,0 +1,191 @@
+---
+title: Function
+slug: Web/JavaScript/Reference/Global_Objects/Function
+tags:
+ - JavaScript
+ - JavaScript Reference
+ - NeedsTranslation
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/Function
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Function</code> 建構函式</strong>可建立一個新的 <code>Function</code> 物件。在 JavaScript 中,所有的函式實際上都是 <code>Function</code> 物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>new Function ([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>function 的引數名稱必須要符合正規的命名。每個名稱都必須要是有效的 JavaScript 識別符號規則的字串,或是使用英文逗號「, 」分隔開的字串清單; 像是 "x", "theValue", 或是 "a, b'。</dd>
+ <dt><code>functionBody</code></dt>
+ <dd><span class="_3oh- _58nk">包含 JavaScript 狀態以及 function 定義的字串。</span></dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Function</code> objects created with the <code>Function</code> constructor are parsed when the function is created. This is less efficient than declaring a function with a <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/function">function expression</a> or <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/function">function statement</a> and calling it within your code, because such functions are parsed with the rest of the code.</p>
+
+<p>All arguments passed to the function are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed.</p>
+
+<p>Invoking the <code>Function</code> constructor as a function (without using the <code>new</code> operator) has the same effect as invoking it as a constructor.</p>
+
+<h2 id="Function_的屬性與方法"><code>Function</code> <code>的屬性與方法</code></h2>
+
+<p>The global <code>Function</code> object has no methods or properties of its own, however, since it is a function itself it does inherit some methods and properties through the prototype chain from {{jsxref("Function.prototype")}}.</p>
+
+<h2 id="Function_原型物件"><code>Function</code> 原型物件</h2>
+
+<h3 id="屬性_Properties">屬性 Properties</h3>
+
+<div>{{page('/zh-TW/docs/JavaScript/Reference/Global_Objects/Function/prototype', 'Properties')}}</div>
+
+<h3 id="方法_Methods">方法 Methods</h3>
+
+<div>{{page('/zh-TW/docs/JavaScript/Reference/Global_Objects/Function/prototype', 'Methods')}}</div>
+
+<h2 id="Function_實例"><code>Function</code> 實例</h2>
+
+<p><code>Function</code> instances inherit methods and properties from {{jsxref("Function.prototype")}}. As with all constructors, you can change the constructor's prototype object to make changes to all <code>Function</code> instances.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Specifying_arguments_with_the_Function_constructor">Specifying arguments with the <code>Function</code> constructor</h3>
+
+<p>The following code creates a <code>Function</code> object that takes two arguments.</p>
+
+<pre class="brush: js">// Example can be run directly in your JavaScript console
+
+// Create a function that takes two arguments and returns the sum of those arguments
+var adder = new Function('a', 'b', 'return a + b');
+
+// Call the function
+adder(2, 6);
+// &gt; 8
+</pre>
+
+<p>The arguments "<code>a</code>" and "<code>b</code>" are formal argument names that are used in the function body, "<code>return a + b</code>".</p>
+
+<h3 id="Difference_between_Function_constructor_and_function_declaration">Difference between Function constructor and function declaration</h3>
+
+<p>Functions created with the <code>Function</code> constructor do not create closures to their creation contexts; they always are created in the global scope. When running them, they will only be able to access their own local variables and global ones, not the ones from the scope in which the <code>Function</code> constructor was called. This is different from using {{jsxref("eval")}} with code for a function expression.</p>
+
+<pre class="brush: js">var x = 10;
+
+function createFunction1() {
+ var x = 20;
+ return new Function('return x;'); // this |x| refers global |x|
+}
+
+function createFunction2() {
+ var x = 20;
+ function f() {
+ return x; // this |x| refers local |x| above
+ }
+ return f;
+}
+
+var f1 = createFunction1();
+console.log(f1()); // 10
+var f2 = createFunction2();
+console.log(f2()); // 20
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.3', 'Function')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function-objects', 'Function')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-objects', 'Function')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Functions", "Functions and function scope")}}</li>
+ <li>{{jsxref("Function")}}</li>
+ <li>{{jsxref("Statements/function", "function statement")}}</li>
+ <li>{{jsxref("Operators/function", "function expression")}}</li>
+ <li>{{jsxref("Statements/function*", "function* statement")}}</li>
+ <li>{{jsxref("Operators/function*", "function* expression")}}</li>
+ <li>{{jsxref("GeneratorFunction")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html
new file mode 100644
index 0000000000..699e1ff178
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/length/index.html
@@ -0,0 +1,144 @@
+---
+title: Function.length
+slug: Web/JavaScript/Reference/Global_Objects/Function/length
+translation_of: Web/JavaScript/Reference/Global_Objects/Function/length
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>length</strong></code> property表示該 function 預期被傳入的參數數量</p>
+
+<div>{{js_property_attributes(0,0,1)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p><code>length</code> 是 function 物件的一個 property,表示該 function 預期被傳入的參數數量,這個數量並不包含 {{jsxref("rest_parameters", "rest parameter", "", 1)}} 且只包涵第一個預設參數(Default Parameters)前的參數。相較之下 {{jsxref("Functions_and_function_scope/arguments/length", "arguments.length")}} 是 function 內部的物件,會提供真正傳進 function 中的參數數量。</p>
+
+<h3 id="Function_建構子的_data_property"><code>Function</code> 建構子的 data property</h3>
+
+<p>{{jsxref("Function")}} 建構子本身就是一個 {{jsxref("Function")}} 物件。其 <code>length</code> data property 的值為 1。此 property 的 attributes 包含: Writable: <code>false</code>, Enumerable: <code>false</code>, Configurable: <code>true</code>.</p>
+
+<h3 id="Function_prototype_物件的_property"><code>Function</code> prototype 物件的 property</h3>
+
+<p>{{jsxref("Function")}} prototype 物件的 length property 其值為 0。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">console.log(Function.length); /* 1 */
+
+console.log((function() {}).length); /* 0 */
+console.log((function(a) {}).length); /* 1 */
+console.log((function(a, b) {}).length); /* 2 以此類推. */
+
+console.log((function(...args) {}).length); /* 0, rest parameter 不包含在內 */
+
+console.log((function(a, b = 1, c) {}).length); /* 1 */
+// 只有在預設參數前的參數會被算到,也就是只有 a 會被視為必須傳入的參數
+// 而 c 將被預設為 undefined
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註釋</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>最初的定義,在 JavaScript 1.1 中實作。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.3.5.1', 'Function.length')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function-instances-length', 'Function.length')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td><code>此 </code>property 的 <code>configurable</code> attribute 現在為 <code>true</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-instances-length', 'Function.length')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>特點</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Configurable: true</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop(37)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>Configurable: true</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile(37)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="可參閱">可參閱</h2>
+
+<ul>
+ <li>{{jsxref("Function")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html
new file mode 100644
index 0000000000..1db46bc59a
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/function/prototype/index.html
@@ -0,0 +1,138 @@
+---
+title: Function.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Function/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Function
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Function.prototype</strong></code> 屬性表示 {{jsxref("Function")}} 的原型物件。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>{{jsxref("Function")}} objects inherit from <code>Function.prototype</code>.  <code>Function.prototype</code> cannot be modified.</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Function.arguments")}} {{deprecated_inline}}</dt>
+ <dd>An array corresponding to the arguments passed to a function. This is deprecated as property of {{jsxref("Function")}}, use the {{jsxref("Functions/arguments", "arguments")}} object available within the function instead.</dd>
+ <dt><s class="obsoleteElement">{{jsxref("Function.arity")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">Used to specifiy the number of arguments expected by the function, but has been removed. Use the {{jsxref("Function.length", "length")}} property instead.</s></dd>
+ <dt>{{jsxref("Function.caller")}} {{non-standard_inline}}</dt>
+ <dd>Specifies the function that invoked the currently executing function.</dd>
+ <dt>{{jsxref("Function.length")}}</dt>
+ <dd>Specifies the number of arguments expected by the function.</dd>
+ <dt>{{jsxref("Function.name")}}</dt>
+ <dd>The name of the function.</dd>
+ <dt>{{jsxref("Function.displayName")}} {{non-standard_inline}}</dt>
+ <dd>The display name of the function.</dd>
+ <dt><code>Function.prototype.constructor</code></dt>
+ <dd>Specifies the function that creates an object's prototype. See {{jsxref("Object.prototype.constructor")}} for more details.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Function.prototype.apply()")}}</dt>
+ <dd>Calls a function and sets its <em>this</em> to the provided value, arguments can be passed as an {{jsxref("Array")}} object.</dd>
+ <dt>{{jsxref("Function.prototype.bind()")}}</dt>
+ <dd>Creates a new function which, when called, has its <em>this</em> set to the provided value, with a given sequence of arguments preceding any provided when the new function was called.</dd>
+ <dt>{{jsxref("Function.prototype.call()")}}</dt>
+ <dd>Calls (executes) a function and sets its <em>this</em> to the provided value, arguments can be passed as they are.</dd>
+ <dt>{{jsxref("Function.prototype.isGenerator()")}} {{non-standard_inline}}</dt>
+ <dd>Returns <code>true</code> if the function is a <a href="/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators">generator</a>; otherwise returns <code>false</code>.</dd>
+ <dt>{{jsxref("Function.prototype.toSource()")}} {{non-standard_inline}}</dt>
+ <dd>Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toSource")}} method.</dd>
+ <dt>{{jsxref("Function.prototype.toString()")}}</dt>
+ <dd>Returns a string representing the source code of the function. Overrides the {{jsxref("Object.prototype.toString")}} method.</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.3.5.2', 'Function.prototype')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-function-instances-prototype', 'Function.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-function-instances-prototype', 'Function.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Function")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/index.html b/files/zh-tw/web/javascript/reference/global_objects/index.html
new file mode 100644
index 0000000000..c9e81579fb
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/index.html
@@ -0,0 +1,201 @@
+---
+title: 標準內建物件
+slug: Web/JavaScript/Reference/Global_Objects
+tags:
+ - JavaScript
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p>本章節記錄了 JavaScript 所有標準、內建的物件,以及這些物件的方法與屬性。</p>
+
+<p>「全域物件」(或稱作標準內建物件)這個專有名字並非是要和<strong>全域物件</strong>混著說。在這裡,全域物件是那些在全域範圍裡的物件。而<strong>全域物件</strong>自身則是關聯到全域範圍裡的 {{jsxref("Operators/this", "this")}} 運算子(但若是在 ECMAScript 5 的嚴格模式(strict mode)則是不被採用的,即會回傳 {{jsxref("undefined")}})。 事實上,全域範圍包含了全域物件的屬性,也包含了繼承而來的屬性(如果有的話)。</p>
+
+<p>其他在全域範疇的物件,不是<a href="/zh-TW/docs/Web/JavaScript/Guide/Working_with_Objects#Creating_new_objects">被使用者的腳本建立</a>,就是由主體的應用程式所提供。 主體物件是由 <a href="/zh-TW/docs/Web/API/Reference">API 參考資料</a>定義的文件決定瀏覽器環境中是否可用。 更多關於 <a href="/zh-TW/docs/DOM/DOM_Reference">DOM</a> 和 <a href="/zh-TW/docs/Web/JavaScript">JavaScript</a> 核心的差異,請參考 <a href="/zh-TW/docs/Web/JavaScript/JavaScript_technologies_overview">JavaScript 技術概要</a>。</p>
+
+<h2 id="標準物件分類">標準物件分類</h2>
+
+<h3 id="數值屬性">數值屬性</h3>
+
+<p>這些全域屬性會返回一個值;全域屬性本身不擁有任何屬性和函式。</p>
+
+<ul>
+ <li>{{jsxref("Infinity")}}</li>
+ <li>{{jsxref("NaN")}}</li>
+ <li>{{jsxref("undefined")}}</li>
+ <li>{{jsxref("null")}} literal</li>
+</ul>
+
+<h3 id="函數屬性">函數屬性</h3>
+
+<p>這些全域函式會直接在全域範圍中被呼叫,不用從某個物件取得後呼叫;呼叫後直接回傳結果給執行的人。</p>
+
+<ul>
+ <li>{{jsxref("Global_Objects/eval", "eval()")}}</li>
+ <li>{{jsxref("Global_Objects/uneval", "uneval()")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("Global_Objects/isFinite", "isFinite()")}}</li>
+ <li>{{jsxref("Global_Objects/isNaN", "isNaN()")}}</li>
+ <li>{{jsxref("Global_Objects/parseFloat", "parseFloat()")}}</li>
+ <li>{{jsxref("Global_Objects/parseInt", "parseInt()")}}</li>
+ <li>{{jsxref("Global_Objects/decodeURI", "decodeURI()")}}</li>
+ <li>{{jsxref("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}</li>
+ <li>{{jsxref("Global_Objects/encodeURI", "encodeURI()")}}</li>
+ <li>{{jsxref("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}</li>
+ <li>{{jsxref("Global_Objects/escape", "escape()")}} {{deprecated_inline}}</li>
+ <li>{{jsxref("Global_Objects/unescape", "unescape()")}} {{deprecated_inline}}</li>
+</ul>
+
+<h3 id="基礎物件">基礎物件</h3>
+
+<p>這裡所陳列稱為基礎物件,將作為其他所有物件的母物件。包含了一般物件、函式以及錯誤。</p>
+
+<ul>
+ <li>{{jsxref("Object")}}</li>
+ <li>{{jsxref("Function")}}</li>
+ <li>{{jsxref("Boolean")}}</li>
+ <li>{{jsxref("Symbol")}}</li>
+ <li>{{jsxref("Error")}}</li>
+ <li>{{jsxref("EvalError")}}</li>
+ <li>{{jsxref("InternalError")}}</li>
+ <li>{{jsxref("RangeError")}}</li>
+ <li>{{jsxref("ReferenceError")}}</li>
+ <li>{{jsxref("SyntaxError")}}</li>
+ <li>{{jsxref("TypeError")}}</li>
+ <li>{{jsxref("URIError")}}</li>
+</ul>
+
+<h3 id="數字與日期">數字與日期</h3>
+
+<p>這裡陳列了數字、日期及數學運算。</p>
+
+<ul>
+ <li>{{jsxref("Number")}}</li>
+ <li>{{jsxref("Math")}}</li>
+ <li>{{jsxref("Date")}}</li>
+</ul>
+
+<h3 id="文字處理">文字處理</h3>
+
+<p>These objects represent strings and support manipulating them.</p>
+
+<ul>
+ <li>{{jsxref("String")}}</li>
+ <li>{{jsxref("RegExp")}}</li>
+</ul>
+
+<h3 id="具索引的集合">具索引的集合</h3>
+
+<p>These objects represent collections of data which are ordered by an index value. This includes (typed) arrays and array-like constructs.</p>
+
+<ul>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("Int8Array")}}</li>
+ <li>{{jsxref("Uint8Array")}}</li>
+ <li>{{jsxref("Uint8ClampedArray")}}</li>
+ <li>{{jsxref("Int16Array")}}</li>
+ <li>{{jsxref("Uint16Array")}}</li>
+ <li>{{jsxref("Int32Array")}}</li>
+ <li>{{jsxref("Uint32Array")}}</li>
+ <li>{{jsxref("Float32Array")}}</li>
+ <li>{{jsxref("Float64Array")}}</li>
+</ul>
+
+<h3 id="具鍵值的集合">具鍵值的集合</h3>
+
+<p>These objects represent collections which use keys; these contain elements which are iterable in the order of insertion.</p>
+
+<ul>
+ <li>{{jsxref("Map")}}</li>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("WeakMap")}}</li>
+ <li>{{jsxref("WeakSet")}}</li>
+</ul>
+
+<h3 id="向量集合">向量集合</h3>
+
+<p>{{Glossary("SIMD")}} vector data types are objects where data is arranged into lanes.</p>
+
+<ul>
+ <li>{{jsxref("SIMD")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Float32x4", "SIMD.Float32x4")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Float64x2", "SIMD.Float64x2")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Int8x16", "SIMD.Int8x16")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Int16x8", "SIMD.Int16x8")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Int32x4", "SIMD.Int32x4")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Uint8x16", "SIMD.Uint8x16")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Uint16x8", "SIMD.Uint16x8")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Uint32x4", "SIMD.Uint32x4")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Bool8x16", "SIMD.Bool8x16")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Bool16x8", "SIMD.Bool16x8")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Bool32x4", "SIMD.Bool32x4")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Bool64x2", "SIMD.Bool64x2")}} {{experimental_inline}}</li>
+</ul>
+
+<h3 id="結構化資料">結構化資料</h3>
+
+<p>These objects represent and interact with structured data buffers and data coded using JavaScript Object Notation (JSON).</p>
+
+<ul>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+ <li>{{jsxref("SharedArrayBuffer")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Atomics")}} {{experimental_inline}}</li>
+ <li>{{jsxref("DataView")}}</li>
+ <li>{{jsxref("JSON")}}</li>
+</ul>
+
+<h3 id="控制抽象化物件">控制抽象化物件</h3>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Generator")}}</li>
+ <li>{{jsxref("GeneratorFunction")}}</li>
+ <li>{{experimental_inline}} {{jsxref("AsyncFunction")}}</li>
+</ul>
+
+<h3 id="Reflection">Reflection</h3>
+
+<ul>
+ <li>{{jsxref("Reflect")}}</li>
+ <li>{{jsxref("Proxy")}}</li>
+</ul>
+
+<h3 id="國際化">國際化</h3>
+
+<p>Additions to the ECMAScript core for language-sensitive functionalities.</p>
+
+<ul>
+ <li>{{jsxref("Intl")}}</li>
+ <li>{{jsxref("Global_Objects/Collator", "Intl.Collator")}}</li>
+ <li>{{jsxref("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}</li>
+ <li>{{jsxref("Global_Objects/NumberFormat", "Intl.NumberFormat")}}</li>
+</ul>
+
+<h3 id="WebAssembly">WebAssembly</h3>
+
+<ul>
+ <li>{{jsxref("WebAssembly")}}</li>
+ <li>{{jsxref("WebAssembly.Module")}}</li>
+ <li>{{jsxref("WebAssembly.Instance")}}</li>
+ <li>{{jsxref("WebAssembly.Memory")}}</li>
+ <li>{{jsxref("WebAssembly.Table")}}</li>
+ <li>{{jsxref("WebAssembly.CompileError")}}</li>
+ <li>{{jsxref("WebAssembly.LinkError")}}</li>
+ <li>{{jsxref("WebAssembly.RuntimeError")}}</li>
+</ul>
+
+<h3 id="非標準物件">非標準物件</h3>
+
+<ul>
+ <li>{{jsxref("Iterator")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("ParallelArray")}} {{non-standard_inline}}</li>
+ <li>{{jsxref("StopIteration")}} {{non-standard_inline}}</li>
+</ul>
+
+<h3 id="其他">其他</h3>
+
+<ul>
+ <li><code><a href="/docs/Web/JavaScript/Reference/Functions/arguments">arguments</a></code></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/infinity/index.html b/files/zh-tw/web/javascript/reference/global_objects/infinity/index.html
new file mode 100644
index 0000000000..147914eea7
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/infinity/index.html
@@ -0,0 +1,76 @@
+---
+title: Infinity
+slug: Web/JavaScript/Reference/Global_Objects/Infinity
+translation_of: Web/JavaScript/Reference/Global_Objects/Infinity
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p>全域 <code><strong>Infinity</strong></code> 屬性是一個表示無窮大的數值。</p>
+
+<p>{{js_property_attributes(0,0,0)}}</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Infinity </code></pre>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Infinity</code> 是全域物件屬性,即它是全域範圍內的變數。</p>
+
+<p><code>Infinity</code> 的初始值是 {{jsxref("Number.POSITIVE_INFINITY")}} <code>Infinity</code> 值(正無窮大)值大於其他任何數值。該值在數學上表現為無窮大。例如,任何乘以 <code>Infinity</code> 的正整數都是 <code>Infinity</code>,除以 <code>Infinity</code> 的任何數都是 0。</p>
+
+<p>按照 ECMAScript 5 規範,在 JavaScript 1.8.5 / Firefox 4 實作的 <code>Infinity</code> 乃唯讀屬性。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">console.log(Infinity ); /* Infinity */
+console.log(Infinity + 1 ); /* Infinity */
+console.log(Math.pow(10,1000)); /* Infinity */
+console.log(Math.log(0) ); /* -Infinity */
+console.log(1 / Infinity ); /* 0 */
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義。在 JavaScript 1.3 實作。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.1.1.2', 'Infinity')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-value-properties-of-the-global-object-infinity', 'Infinity')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{Compat("javascript.builtins.Infinity")}}</p>
+
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Number.NEGATIVE_INFINITY")}}</li>
+ <li>{{jsxref("Number.POSITIVE_INFINITY")}}</li>
+ <li>{{jsxref("Number.isFinite")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/isnan/index.html b/files/zh-tw/web/javascript/reference/global_objects/isnan/index.html
new file mode 100644
index 0000000000..6f055cb8fa
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/isnan/index.html
@@ -0,0 +1,183 @@
+---
+title: isNaN()
+slug: Web/JavaScript/Reference/Global_Objects/isNaN
+translation_of: Web/JavaScript/Reference/Global_Objects/isNaN
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p><code><strong>isNaN()</strong></code> 函式會判斷某個數值是不是 {{jsxref("NaN")}}。注意:在 <code>isNaN</code> 函式裡面,有個<a href="#描述">有趣的</a>強制性規則。你可能會想改用在 ECMAScript 2015 導入的 {{jsxref("Number.isNaN()")}}。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/globalprops-isnan.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>isNaN(<em>value</em>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>要測試的數值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>如果給定值是 {{jsxref("NaN")}} 就回傳 <strong><code>true</code></strong>、否則就回傳 <strong><code>false</code></strong>。</p>
+
+<h2 id="描述">描述</h2>
+
+<h3 id="為什麼要用_isNaN_函式">為什麼要用 <code>isNaN</code> 函式</h3>
+
+<p>與其他 JavaScript 的值不同,你不可能靠等號運算符(== 與 ===)來判斷某個值是不是 {{jsxref("NaN")}},因為連 <code>NaN == NaN</code> 與 <code>NaN === NaN</code> 的結果都是 <code>false</code>。因此,<code>isNaN</code> 函式是必要的。</p>
+
+<h3 id="NaN_值的來源"><code>NaN</code> 值的來源</h3>
+
+<p><code>NaN</code> 會在算術運算(arithmetic operations)出現 <em>undefined</em> 或是 <em>unrepresentable</em> 值的結果時產生。這些值不一定是溢出條件。<code>NaN</code> 亦為試圖給毫無可用數字的原始值、予以強制運算之結果。</p>
+
+<p>例如,零除以零的結果會是 <code>NaN</code>——不過把其他數字除以零則不是 <code>NaN</code>。</p>
+
+<h3 id="令人困惑的特殊狀況行為">令人困惑的特殊狀況行為</h3>
+
+<p>從最早的 <code>isNaN</code> 函式版本規範始,其針對非數值之行為,不斷教人困惑至極。當 <code>isNaN</code> 函式的參數並非<a href="http://es5.github.com/#x8.5" title="http://es5.github.com/#x8.5">數字</a>型別時,此值會先強制轉換到數字。該值接著會測定此值是否為 {{jsxref("NaN")}}。因此,當被強制轉換的非數字,給出了有效的非 NaN 值(經典案例為空的字串與布林原始值:它們在強制轉換時,會給予數字結果 0 或 1)時,會回傳不如預期的「false」值:以空的字串為例,它很明顯地「非數字」。這段教人糾結的點,乃出於「非數字」術語的「數字」一詞、由 IEEE-754 浮點值定義之事實而來。這個函式要解釋為「當這個值,被強制轉換為數值時,它還是 IEEE-754 的『非數字』值嗎?」的答案。</p>
+
+<p>最新的 ECMAScript(ES2015)版本導入了 {{jsxref("Number.isNaN()")}} 函式。儘管 <code>Number.isNaN</code> 的 <code>NaN</code> 依舊維持了數字上的意義、而不是簡單的「非數字」,<code>Number.isNaN(x)</code> 在偵測 <code>x</code> 為 <code>NaN</code> 與否時比較可靠。另外,如果在缺少 <code>Number.isNaN</code> 的情況下,通過表達式<code>(x != x)</code> 來檢測變量<code>x</code>是否是NaN會更加的可靠。</p>
+
+<p>一個 <code>isNaN</code> 的 polyfill 可以理解為(這個 polyfill 利用了 <code>NaN</code> 自身永不等於自身這一特性):</p>
+
+<pre class="brush: js">var isNaN = function(value) {
+ var n = Number(value);
+ return n !== n;
+};</pre>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">isNaN(NaN); // true
+isNaN(undefined); // true
+isNaN({}); // true
+
+isNaN(true); // false
+isNaN(null); // false
+isNaN(37); // false
+
+// 字串
+isNaN("37"); // false: "37" 轉換成數字的 37 後就不是 NaN 了
+isNaN("37.37"); // false: "37.37" 轉換成數字的 37.37 後就不是 NaN 了
+isNaN("123ABC"); // true: parseInt("123ABC") 是 123 但 Number("123ABC") 是 NaN
+isNaN(""); // false: 空字串轉換成數字的 0 後就不是 NaN 了
+isNaN(" "); // false: 有空白的字串轉換成數字的 0 後就不是 NaN 了
+
+// 日期
+isNaN(new Date()); // false
+isNaN(new Date().toString()); // true
+
+// 這個偵測的錯誤是不能完全信賴 isNaN 的理由
+isNaN("blabla") // true: "blabla" 被轉換為數字,將其解析為數字失敗後回傳了 NaN
+</pre>
+
+<h3 id="實用的特殊狀況行為">實用的特殊狀況行為</h3>
+
+<p>當然,你能以更用途導向的方法去思考 <code>isNaN()</code>:如果 <code>isNaN()</code> 回傳 <code>false</code>,那麼把 <code>x</code> 用在任何算術表達式都不會回傳 <code>NaN</code>。相反地,如果回傳 <code>true</code>,那麼把 <code>x</code> 用在任何算術表達式都會是 <code>NaN</code>。這在 JavaScript 的意義是 <code>isNaN(x) == true</code> 等於 <code>x - 0</code> 回傳 <code>NaN</code>(儘管在 JavaScript 裡面 <code>x - 0 == NaN</code> 永遠回傳 false,你因而無法測試)──事實上,<code>isNaN(x)</code>、<code>isNaN(x - 0)</code>、<code>isNaN(Number(x))</code>、<code>Number.isNaN(x - 0)</code>、<code>Number.isNaN(Number(x))</code> 在 JavaScript 裡面,都會回傳一樣的東西。而 <code>isNaN(x)</code> 是所有表達式裡面最短的一種。</p>
+
+<p>比方說,你可以用這個式子,去測試函式的參數能不能透過算術處理(也就是能「像」數字一樣被利用)、否則就提供預設值之類的。你可以透過上下文的根據以隱式數值轉換(implicitly converting values),以使用 JavaScript 提供的全部功能。</p>
+
+<h2 id="範例_2">範例</h2>
+
+<pre class="brush: js">function increment(x) {
+ if (isNaN(x)) x = 0;
+ return x + 1;
+};
+
+// 與 Number.isNaN() 一樣:
+function increment(x) {
+ if (Number.isNaN(Number(x))) x = 0;
+ return x + 1;
+};
+
+// 以下範例的函式參數 x,isNaN(x) 都會回傳 false,
+// 儘管 x 不是數字,依舊能用在算術表達式。
+increment(""); // 1: "" 被轉換成 0
+increment(new String()); // 1: 空字串的新字串物件被轉換成 0
+increment([]); // 1: [] 被轉換成 0
+increment(new Array()); // 1: 空陣列的新陣列物件被轉換成 0
+increment("0"); // 1: "0" 被轉換成 0
+increment("1"); // 2: "1" 被轉換成 1
+increment("0.1"); // 1.1: "0.1" 被轉換成 0.1
+increment("Infinity"); // Infinity: "Infinity" 被轉換成 Infinity
+increment(null); // 1: null 被轉換成 0
+increment(false); // 1: false 被轉換成 0
+increment(true); // 2: true 被轉換成 1
+increment(new Date()); // 回傳以毫秒為單位加 1,當今的日期/時間
+
+// 以下範例的函式參數 x,isNaN(x) 都會回傳 false,而 x 的確是數字。
+increment(-1); // 0
+increment(-0.1); // 0.9
+increment(0); // 1
+increment(1); // 2
+increment(2); // 3
+// …等等…
+increment(Infinity); // Infinity
+
+// 以下範例的函式參數 x,isNaN(x) 都會回傳 true,x 也的確不是數字。
+// 使得函式會被 0 取代,並回傳 1
+increment(String); // 1
+increment(Array); // 1
+increment("blabla"); // 1
+increment("-blabla"); // 1
+increment(0/0); // 1
+increment("0/0"); // 1
+increment(Infinity/Infinity); // 1
+increment(NaN); // 1
+increment(undefined); // 1
+increment(); // 1
+
+// isNaN(x) 與 isNaN(Number(x)) 永遠一樣,不過這裡的 x 是強制存在的!
+isNaN(x) == isNaN(Number(x)) // 針對所有 x 的值都是 true,x == undefined 也不例外,
+ // 因為 isNaN(undefined) == true 且 Number(undefined) 回傳 NaN,
+ // 不過……
+isNaN() == isNaN(Number()) // false,因為 isNaN() == true 且 Number() == 0
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.1.2.4', 'isNaN')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-isnan-number', 'isNaN')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-isnan-number', 'isNaN')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.isNaN")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("NaN")}}</li>
+ <li>{{jsxref("Number.isNaN()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/index.html
new file mode 100644
index 0000000000..8d3aeadbf2
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/json/index.html
@@ -0,0 +1,206 @@
+---
+title: JSON
+slug: Web/JavaScript/Reference/Global_Objects/JSON
+tags:
+ - JSON
+ - JavaScript
+ - NeedsTranslation
+ - Object
+ - Reference
+ - Référence(2)
+ - TopicStub
+ - polyfill
+translation_of: Web/JavaScript/Reference/Global_Objects/JSON
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>JSON</code></strong> 物件包含了解析、或是轉換為 <a class="external" href="http://json.org/">JavaScript Object Notation</a>({{glossary("JSON")}})格式的方法。這物件不能被呼叫或建構;而除了它的兩個方法屬性以外,本身也沒有特別的功能。</p>
+
+<h2 id="描述">描述</h2>
+
+<h3 id="JavaScript_Object_Notation">JavaScript Object Notation</h3>
+
+<p>JSON 是序列物件、陣列、數字、字串、布林值、還有 {{jsxref("null")}} 的語法。它建基、但不同於 JavaScript:有些 JavaScript 不是 JSON、而有些 JSON 不是 JavaScript。請參見 <a href="http://timelessrepo.com/json-isnt-a-javascript-subset">JSON: The JavaScript subset that isn't</a>。</p>
+
+<table>
+ <caption>JavaScript 與 JSON 的差別</caption>
+ <thead>
+ <tr>
+ <th scope="col">JavaScript 型別</th>
+ <th scope="col">與 JSON 的差別</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>物件與陣列</td>
+ <td>屬性名稱必須是包含在雙引號中的字串;禁止尾後逗號。</td>
+ </tr>
+ <tr>
+ <td>數字</td>
+ <td>數字不可以0作為開頭(在 JSON.stringify 0會被忽略,但是在 JSON.parse 會造成語法錯誤);小數點前面必須至少有一位數字。</td>
+ </tr>
+ <tr>
+ <td>字串</td>
+ <td>
+ <p>Only a limited set of characters may be escaped; certain control characters are prohibited; the Unicode line separator (<a href="http://unicode-table.com/en/2028/">U+2028</a>) and paragraph separator (<a href="http://unicode-table.com/en/2029/">U+2029</a>) characters are permitted; strings must be double-quoted. See the following example where {{jsxref("JSON.parse()")}} works fine and a {{jsxref("SyntaxError")}} is thrown when evaluating the code as JavaScript:</p>
+
+ <pre class="brush: js">
+var code = '"\u2028\u2029"';
+JSON.parse(code); // works fine
+eval(code); // fails
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<p>JSON 的完整語法如下:</p>
+
+<pre><var>JSON</var> = <strong>null</strong>
+ <em>or</em> <strong>true</strong> <em>or</em> <strong>false</strong>
+ <em>or</em> <var>JSONNumber</var>
+ <em>or</em> <var>JSONString</var>
+ <em>or</em> <var>JSONObject</var>
+ <em>or</em> <var>JSONArray</var>
+
+<var>JSONNumber</var> = <strong>-</strong> <var>PositiveNumber</var>
+ <em>or</em> <var>PositiveNumber</var>
+<var>PositiveNumber</var> = DecimalNumber
+ <em>or</em> <var>DecimalNumber</var> <strong>.</strong> <var>Digits</var>
+ <em>or</em> <var>DecimalNumber</var> <strong>.</strong> <var>Digits</var> <var>ExponentPart</var>
+ <em>or</em> <var>DecimalNumber</var> <var>ExponentPart</var>
+<var>DecimalNumber</var> = <strong>0</strong>
+ <em>or</em> <var>OneToNine</var> <var>Digits</var>
+<var>ExponentPart</var> = <strong>e</strong> <var>Exponent</var>
+ <em>or</em> <strong>E</strong> <var>Exponent</var>
+<var>Exponent</var> = <var>Digits</var>
+ <em>or</em> <strong>+</strong> <var>Digits</var>
+ <em>or</em> <strong>-</strong> <var>Digits</var>
+<var>Digits</var> = <var>Digit</var>
+ <em>or</em> <var>Digits</var> <var>Digit</var>
+<var>Digit</var> = <strong>0</strong> through <strong>9</strong>
+<var>OneToNine</var> = <strong>1</strong> through <strong>9</strong>
+
+<var>JSONString</var> = <strong>""</strong>
+ <em>or</em> <strong>"</strong> <var>StringCharacters</var> <strong>"</strong>
+<var>StringCharacters</var> = <var>StringCharacter</var>
+ <em>or</em> <var>StringCharacters</var> <var>StringCharacter</var>
+<var>StringCharacter</var> = any character
+ <em>except</em> <strong>"</strong> <em>or</em> <strong>\</strong> <em>or</em> U+0000 through U+001F
+ <em>or</em> <var>EscapeSequence</var>
+<var>EscapeSequence</var> = <strong>\"</strong> <em>or</em> <strong>\/</strong> <em>or</em> <strong>\\</strong> <em>or</em> <strong>\b</strong> <em>or</em> <strong>\f</strong> <em>or</em> <strong>\n</strong> <em>or</em> <strong>\r</strong> <em>or</em> <strong>\t</strong>
+ <em>or</em> <strong>\u</strong> <var>HexDigit</var> <var>HexDigit</var> <var>HexDigit</var> <var>HexDigit</var>
+<var>HexDigit</var> = <strong>0</strong> through <strong>9</strong>
+ <em>or</em> <strong>A</strong> through <strong>F</strong>
+ <em>or</em> <strong>a</strong> through <strong>f</strong>
+
+<var>JSONObject</var> = <strong>{</strong> <strong>}</strong>
+ <em>or</em> <strong>{</strong> <var>Members</var> <strong>}</strong>
+<var>Members</var> = <var>JSONString</var> <strong>:</strong> <var>JSON</var>
+ <em>or</em> <var>Members</var> <strong>,</strong> <var>JSONString</var> <strong>:</strong> <var>JSON</var>
+
+<var>JSONArray</var> = <strong>[</strong> <strong>]</strong>
+ <em>or</em> <strong>[</strong> <var>ArrayElements</var> <strong>]</strong>
+<var>ArrayElements</var> = <var>JSON</var>
+ <em>or</em> <var>ArrayElements</var> <strong>,</strong> <var>JSON</var>
+</pre>
+
+<p>Insignificant whitespace may be present anywhere except within a <code><var>JSONNumber</var></code> (numbers must contain no whitespace) or <code><var>JSONString</var></code> (where it is interpreted as the corresponding character in the string, or would cause an error). The tab character (<a href="http://unicode-table.com/en/0009/">U+0009</a>), carriage return (<a href="http://unicode-table.com/en/000D/">U+000D</a>), line feed (<a href="http://unicode-table.com/en/000A/">U+000A</a>), and space (<a href="http://unicode-table.com/en/0020/">U+0020</a>) characters are the only valid whitespace characters.</p>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("JSON.parse()")}}</dt>
+ <dd>解析 JSON 字串,能改變給定值和屬性、接著回傳解析值。</dd>
+ <dt>{{jsxref("JSON.stringify()")}}</dt>
+ <dd>回傳給定的 JSON 對應字串,可自行決定只想包括哪些特定屬性、或替換的屬性值。</dd>
+</dl>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>舊版瀏覽器並不支援 <code>JSON</code>。你可以在程式碼開頭插入以下程式碼,以解決這個問題。這個程式碼能實做不支援原生 <code>JSON</code> 物件的瀏覽器(如 Internet Explorer 6)。</p>
+
+<p>以下演算法能仿製原生 <code>JSON</code> 物件。</p>
+
+<pre class="brush: js">if (!window.JSON) {
+ window.JSON = {
+ parse: function(sJSON) { return eval('(' + sJSON + ')'); },
+ stringify: (function () {
+ var toString = Object.prototype.toString;
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+ var isArray = Array.isArray || function (a) { return toString.call(a) === '[object Array]'; };
+ var escMap = {'"': '\\"', '\\': '\\\\', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t'};
+ var escFunc = function (m) { return escMap[m] || '\\u' + (m.charCodeAt(0) + 0x10000).toString(16).substr(1); };
+ var escRE = /[\\"\u0000-\u001F\u2028\u2029]/g;
+ return function stringify(value) {
+ if (value == null) {
+ return 'null';
+ } else if (typeof value === 'number') {
+ return isFinite(value) ? value.toString() : 'null';
+ } else if (typeof value === 'boolean') {
+ return value.toString();
+ } else if (typeof value === 'object') {
+ if (typeof value.toJSON === 'function') {
+ return stringify(value.toJSON());
+ } else if (isArray(value)) {
+ var res = '[';
+ for (var i = 0; i &lt; value.length; i++)
+ res += (i ? ', ' : '') + stringify(value[i]);
+ return res + ']';
+ } else if (toString.call(value) === '[object Object]') {
+ var tmp = [];
+ for (var k in value) {
+ // in case "hasOwnProperty" has been shadowed
+ if (hasOwnProperty.call(value, k))
+ tmp.push(stringify(k) + ': ' + stringify(value[k]));
+ }
+ return '{' + tmp.join(', ') + '}';
+ }
+ }
+ return '"' + value.toString().replace(escRE, escFunc) + '"';
+ };
+ })()
+ };
+}
+</pre>
+
+<p>More complex well-known <a class="external" href="http://remysharp.com/2010/10/08/what-is-a-polyfill/">polyfills</a> for the <code>JSON</code> object are <a class="link-https" href="https://github.com/douglascrockford/JSON-js">JSON2</a> and <a class="external" href="http://bestiejs.github.com/json3">JSON3</a>.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.12', 'JSON')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-json-object', 'JSON')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-json-object', 'JSON')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<div>{{Compat("javascript.builtins.JSON")}}</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Date.prototype.toJSON()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html
new file mode 100644
index 0000000000..eb821587a5
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/json/parse/index.html
@@ -0,0 +1,170 @@
+---
+title: JSON.parse()
+slug: Web/JavaScript/Reference/Global_Objects/JSON/parse
+translation_of: Web/JavaScript/Reference/Global_Objects/JSON/parse
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>JSON.parse()</code></strong> 方法把會把一個JSON字串轉換成 JavaScript的數值或是物件。另外也可選擇使用reviver函數讓這些數值或是物件在被回傳之前做轉換。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">JSON.parse(<var>text</var>[, <var>reviver</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>text</code></dt>
+ <dd>要解析成 JSON 的字串。針對 JSON 語法的描述,請參見 {{jsxref("JSON")}} 物件。</dd>
+ <dt><code>reviver</code> {{optional_inline}}</dt>
+ <dd>為選擇性的參數,用來描述JSON字串中的值該如何被解析並回傳的函式(function)</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>從給定的 JSON <code>text</code> 回傳對應的 {{jsxref("Object")}}。</p>
+
+<h3 id="Throws">Throws</h3>
+
+<p>如果解析的字串不是合法的JSON格式會丟出一個 {{jsxref("SyntaxError")}} 例外</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_JSON.parse">Using <code>JSON.parse()</code></h3>
+
+<pre class="brush: js">JSON.parse('{}'); // {}
+JSON.parse('true'); // true
+JSON.parse('"foo"'); // "foo"
+JSON.parse('[1, 5, "false"]'); // [1, 5, "false"]
+JSON.parse('null'); // null
+</pre>
+
+<h3 id="使用_reviver_參數">使用 <strong><code>reviver</code></strong> 參數</h3>
+
+<p><code><font face="Open Sans, Arial, sans-serif">如果</font>reviver函數有被指定</code>,字串解析後產生出來的值會在函式回傳前經過轉換。 具體來講,解析後的值或是物件屬性會一個接一個地被這個reviver函數過濾(順序是由巢狀架構中最深的到最淺的),而當一個屬性即將被過濾時,該屬性的名稱(字串形態)以及值會被當作參數傳入reviver函數。如果reviver函數回傳了 {{jsxref("undefined")}} (或是沒有回傳值, 例如:函式提早結束),則該屬性會從物件中被刪除;反之如果成功的話,該屬性的值就會被新的回傳值取代。</p>
+
+<p>如果reviver只需轉換某些特定的值,請記得將其他不須特別轉換的值以原來的值回傳,否則這些值會從回傳的結果物件中刪除。</p>
+
+<pre class="brush: js">JSON.parse('{"p": 5}', function(k, v) {
+ if (typeof v === 'number') {
+ return v * 2; // return v * 2 for numbers
+ }
+ return v; // return everything else unchanged
+});
+
+// { p: 10 }
+
+JSON.parse('{"1": 1, "2": 2, "3": {"4": 4, "5": {"6": 6}}}', function(k, v) {
+ console.log(k); // log the current property name, the last is "".
+ return v; // return the unchanged property value.
+});
+
+// 1
+// 2
+// 4
+// 6
+// 5
+// 3
+// ""
+</pre>
+
+<h3 id="JSON.parse_不容許尾部有逗號"><code>JSON.parse()</code> 不容許尾部有逗號</h3>
+
+<pre class="example-bad brush: js example-bad">// 這兩個都會拋出 SyntaxError
+JSON.parse('[1, 2, 3, 4, ]');
+JSON.parse('{"foo" : 1, }');
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.12.2', 'JSON.parse')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初始定義。從 JavaScript 1.7 導入。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-json.parse', 'JSON.parse')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-json.parse', 'JSON.parse')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>特徵</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基本功能</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("1.9.1")}}</td>
+ <td>{{CompatIE("8.0")}}</td>
+ <td>{{CompatOpera("10.5")}}</td>
+ <td>{{CompatSafari("4.0")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>特徵</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基本功能</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("1.0")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Gecko相關">Gecko相關</h2>
+
+<p>從Gecko 29版本開始{{geckoRelease("29")}},錯誤格式的JSON字串會產生更詳細的錯誤訊息,包含造成解析錯誤的行數及列數。這在針對大量JSON資料進行除錯時會很有幫助。</p>
+
+<pre class="brush: js">JSON.parse('[1, 2, 3, 4,]');
+// SyntaxError: JSON.parse: unexpected character at
+// line 1 column 13 of the JSON data
+</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("JSON.stringify()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html
new file mode 100644
index 0000000000..5169d7d748
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/json/stringify/index.html
@@ -0,0 +1,280 @@
+---
+title: JSON.stringify()
+slug: Web/JavaScript/Reference/Global_Objects/JSON/stringify
+translation_of: Web/JavaScript/Reference/Global_Objects/JSON/stringify
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>JSON.stringify()</code></strong> method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/json-stringify.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>JSON.stringify(<var>value</var>[, <var>replacer</var>[, <var>space</var>]])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>The value to convert to a JSON string.</dd>
+ <dt><code>replacer</code> {{optional_inline}}</dt>
+ <dd>A function that alters the behavior of the stringification process, or an array of {{jsxref("String")}} and {{jsxref("Number")}} objects that serve as a whitelist for selecting/filtering the properties of the value object to be included in the JSON string. If this value is null or not provided, all properties of the object are included in the resulting JSON string.</dd>
+ <dt><code>space</code> {{optional_inline}}</dt>
+ <dd>A {{jsxref("String")}} or {{jsxref("Number")}} object that's used to insert white space into the output JSON string for readability purposes. If this is a <code>Number</code>, it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1 indicate that no space should be used. If this is a <code>String</code>, the string (or the first 10 characters of the string, if it's longer than that) is used as white space. If this parameter is not provided (or is null), no white space is used.</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A JSON string representing the given value.</p>
+
+<h2 id="Description">Description</h2>
+
+<p><code>JSON.stringify()</code> converts a value to JSON notation representing it:</p>
+
+<ul>
+ <li>{{jsxref("Boolean")}}, {{jsxref("Number")}}, and {{jsxref("String")}} objects are converted to the corresponding primitive values during stringification, in accord with the traditional conversion semantics.</li>
+ <li>If {{jsxref("undefined")}}, a function, or a symbol is encountered during conversion it is either omitted (when it is found in an object) or censored to {{jsxref("null")}} (when it is found in an array). <code>JSON.stringify</code> can also just return <code>undefined</code> when passing in "pure" values like <code>JSON.stringify(function(){})</code> or <code>JSON.stringify(undefined)</code>.</li>
+ <li>All symbol-keyed properties will be completely ignored, even when using the <code>replacer</code> function.</li>
+ <li>Non-enumerable properties will be ignored</li>
+</ul>
+
+<pre class="brush: js">JSON.stringify({}); // '{}'
+JSON.stringify(true); // 'true'
+JSON.stringify('foo'); // '"foo"'
+JSON.stringify([1, 'false', false]); // '[1,"false",false]'
+JSON.stringify({ x: 5 }); // '{"x":5}'
+
+JSON.stringify(new Date(2006, 0, 2, 15, 4, 5))
+// '"2006-01-02T15:04:05.000Z"'
+
+JSON.stringify({ x: 5, y: 6 });
+// '{"x":5,"y":6}'
+JSON.stringify([new Number(3), new String('false'), new Boolean(false)]);
+// '[3,"false",false]'
+
+JSON.stringify({ x: [10, undefined, function(){}, Symbol('')] });
+// '{"x":[10,null,null,null]}'
+
+// Symbols:
+JSON.stringify({ x: undefined, y: Object, z: Symbol('') });
+// '{}'
+JSON.stringify({ [Symbol('foo')]: 'foo' });
+// '{}'
+JSON.stringify({ [Symbol.for('foo')]: 'foo' }, [Symbol.for('foo')]);
+// '{}'
+JSON.stringify({ [Symbol.for('foo')]: 'foo' }, function(k, v) {
+ if (typeof k === 'symbol') {
+ return 'a symbol';
+ }
+});
+// '{}'
+
+// Non-enumerable properties:
+JSON.stringify( Object.create(null, { x: { value: 'x', enumerable: false }, y: { value: 'y', enumerable: true } }) );
+// '{"y":"y"}'
+
+</pre>
+
+<h3 id="The_replacer_parameter"><a id="The replacer parameter" name="The replacer parameter"></a>The <code>replacer</code> parameter</h3>
+
+<p>The <code>replacer</code> parameter can be either a function or an array. As a function, it takes two parameters, the key and the value being stringified. The object in which the key was found is provided as the replacer's <code>this</code> parameter. Initially it gets called with an empty key representing the object being stringified, and it then gets called for each property on the object or array being stringified. It should return the value that should be added to the JSON string, as follows:</p>
+
+<ul>
+ <li>If you return a {{jsxref("Number")}}, the string corresponding to that number is used as the value for the property when added to the JSON string.</li>
+ <li>If you return a {{jsxref("String")}}, that string is used as the property's value when adding it to the JSON string.</li>
+ <li>If you return a {{jsxref("Boolean")}}, "true" or "false" is used as the property's value, as appropriate, when adding it to the JSON string.</li>
+ <li>If you return any other object, the object is recursively stringified into the JSON string, calling the <code>replacer</code> function on each property, unless the object is a function, in which case nothing is added to the JSON string.</li>
+ <li>If you return <code>undefined</code>, the property is not included (i.e., filtered out) in the output JSON string.</li>
+</ul>
+
+<div class="note"><strong>Note:</strong> You cannot use the <code>replacer</code> function to remove values from an array. If you return <code>undefined</code> or a function then <code>null</code> is used instead.</div>
+
+<h4 id="Example_with_a_function">Example with a function</h4>
+
+<pre class="brush: js">function replacer(key, value) {
+ // Filtering out properties
+ if (typeof value === 'string') {
+ return undefined;
+ }
+ return value;
+}
+
+var foo = {foundation: 'Mozilla', model: 'box', week: 45, transport: 'car', month: 7};
+JSON.stringify(foo, replacer);
+// '{"week":45,"month":7}'
+</pre>
+
+<h4 id="Example_with_an_array">Example with an array</h4>
+
+<p>If <code>replacer</code> is an array, the array's values indicate the names of the properties in the object that should be included in the resulting JSON string.</p>
+
+<pre class="brush: js">JSON.stringify(foo, ['week', 'month']);
+// '{"week":45,"month":7}', only keep "week" and "month" properties
+</pre>
+
+<h3 id="The_space_argument"><a id="The space argument" name="The space argument"></a>The <code>space</code> argument</h3>
+
+<p>The <code>space</code> argument may be used to control spacing in the final string. If it is a number, successive levels in the stringification will each be indented by this many space characters (up to 10). If it is a string, successive levels will be indented by this string (or the first ten characters of it).</p>
+
+<pre class="brush: js">JSON.stringify({ a: 2 }, null, ' ');
+// '{
+// "a": 2
+// }'
+</pre>
+
+<p>Using a tab character mimics standard pretty-print appearance:</p>
+
+<pre class="brush: js">JSON.stringify({ uno: 1, dos: 2 }, null, '\t');
+// returns the string:
+// '{
+// "uno": 1,
+// "dos": 2
+// }'
+</pre>
+
+<h3 id="toJSON_behavior"><code>toJSON()</code> behavior</h3>
+
+<p>If an object being stringified has a property named <code>toJSON</code> whose value is a function, then the <code>toJSON()</code> method customizes JSON stringification behavior: instead of the object being serialized, the value returned by the <code>toJSON()</code> method when called will be serialized. <code>JSON.stringify()</code> calls <code>toJSON</code> with one parameter:</p>
+
+<ul>
+ <li>if this object is a property value, the property name</li>
+ <li>if it is in an array, the index in the array, as a string</li>
+ <li>an empty string if <code>JSON.stringify()</code> was directly called on this object</li>
+</ul>
+
+<p>For example:</p>
+
+<pre class="brush: js">const bonnie = {
+ name: 'Bonnie Washington',
+ age: 17,
+ class: 'Year 5 Wisdom',
+ isMonitor: false,
+ toJSON: function(key) {
+ // Clone object to prevent accidentally performing modification on the original object
+ const cloneObj = { ...this };
+
+ delete cloneObj.age;
+ delete cloneObj.isMonitor;
+ cloneObj.year = 5;
+ cloneObj.class = 'Wisdom';
+
+ if (key) {
+ cloneObj.code = key;
+ }
+
+ return cloneObj;
+ }
+}
+
+JSON.stringify(bonnie);
+// Returns '{"name":"Bonnie Washington","class":"Wisdom","year":5}'
+
+const students = {bonnie};
+JSON.stringify(students);
+// Returns '{"bonnie":{"name":"Bonnie Washington","class":"Wisdom","year":5,"code":"bonnie"}}'
+
+const monitorCandidate = [bonnie];
+JSON.stringify(monitorCandidate)
+// Returns '[{"name":"Bonnie Washington","class":"Wisdom","year":5,"code":"0"}]'</pre>
+
+<h3 id="Issue_with_plain_JSON.stringify_for_use_as_JavaScript">Issue with plain <code>JSON.stringify</code> for use as JavaScript</h3>
+
+<p>Note that JSON is <a href="http://timelessrepo.com/json-isnt-a-javascript-subset">not a completely strict subset of JavaScript</a>, with two line terminators (Line separator and Paragraph separator) not needing to be escaped in JSON but needing to be escaped in JavaScript. Therefore, if the JSON is meant to be evaluated or directly utilized within <a href="https://en.wikipedia.org/wiki/JSONP">JSONP</a>, the following utility can be used:</p>
+
+<pre class="brush: js">function jsFriendlyJSONStringify (s) {
+ return JSON.stringify(s).
+ replace(/\u2028/g, '\\u2028').
+ replace(/\u2029/g, '\\u2029');
+}
+
+var s = {
+ a: String.fromCharCode(0x2028),
+ b: String.fromCharCode(0x2029)
+};
+try {
+ eval('(' + JSON.stringify(s) + ')');
+} catch (e) {
+ console.log(e); // "SyntaxError: unterminated string literal"
+}
+
+// No need for a catch
+eval('(' + jsFriendlyJSONStringify(s) + ')');
+
+// console.log in Firefox unescapes the Unicode if
+// logged to console, so we use alert
+alert(jsFriendlyJSONStringify(s)); // {"a":"\u2028","b":"\u2029"}</pre>
+
+<h3 id="Example_of_using_JSON.stringify_with_localStorage">Example of using <code>JSON.stringify()</code> with <code>localStorage</code></h3>
+
+<p>In a case where you want to store an object created by your user and allowing it to be restored even after the browser has been closed, the following example is a model for the applicability of <code>JSON.stringify()</code>:</p>
+
+<div class="warning">
+<p>Functions are not a valid JSON data type so they will not work. However, they can be displayed if first converted to a string (e.g. in the replacer), via the function's toString method. Also, some objects like {{jsxref("Date")}} will be a string after {{jsxref("JSON.parse()")}}.</p>
+</div>
+
+<pre class="brush: js">// Creating an example of JSON
+var session = {
+ 'screens': [],
+ 'state': true
+};
+session.screens.push({ 'name': 'screenA', 'width': 450, 'height': 250 });
+session.screens.push({ 'name': 'screenB', 'width': 650, 'height': 350 });
+session.screens.push({ 'name': 'screenC', 'width': 750, 'height': 120 });
+session.screens.push({ 'name': 'screenD', 'width': 250, 'height': 60 });
+session.screens.push({ 'name': 'screenE', 'width': 390, 'height': 120 });
+session.screens.push({ 'name': 'screenF', 'width': 1240, 'height': 650 });
+
+// Converting the JSON string with JSON.stringify()
+// then saving with localStorage in the name of session
+localStorage.setItem('session', JSON.stringify(session));
+
+// Example of how to transform the String generated through
+// JSON.stringify() and saved in localStorage in JSON object again
+var restoredSession = JSON.parse(localStorage.getItem('session'));
+
+// Now restoredSession variable contains the object that was saved
+// in localStorage
+console.log(restoredSession);
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.12.3', 'JSON.stringify')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.7.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-json.stringify', 'JSON.stringify')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-json.stringify', 'JSON.stringify')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.JSON.stringify")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("JSON.parse()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/map/index.html b/files/zh-tw/web/javascript/reference/global_objects/map/index.html
new file mode 100644
index 0000000000..07dc862188
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/map/index.html
@@ -0,0 +1,265 @@
+---
+title: Map
+slug: Web/JavaScript/Reference/Global_Objects/Map
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - Map
+translation_of: Web/JavaScript/Reference/Global_Objects/Map
+---
+<div>{{JSRef}}</div>
+
+<p><span class="seoSummary"><strong><code>Map</code></strong> 是保存了鍵值對(key-value pairs)的物件。</span>任何值(包括物件及{{Glossary("Primitive", "基本型別(primitive)值")}})都可以作為鍵或值。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new Map([<em>iterable</em>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>iterable</code></dt>
+ <dd>為一個{{jsxref("Array", "陣列")}}或其他元素成鍵值對的<a href="/zh-TW/docs/Web/JavaScript/Guide/iterable">可迭代</a>物件(有兩個元素的陣列,例如 <code>[[ 1, 'one' ],[ 2, 'two' ]]</code>)。每一個鍵值對都會被加入至新的 <code>Map</code>;<code>null</code> 會被視為 <code>undefined</code>。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>一個 <code>Map</code> 物件會根據元素的新增順序走訪自身的所有元素 — {{jsxref("Statements/for...of", "for...of")}} 迴圈會在每次迭代回傳一個 <code>[key, value]</code> 陣列。</p>
+
+
+
+<h3 id="鍵的相等性">鍵的相等性</h3>
+
+<p>鍵相等是基於 <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality">SameValueZero</a> 的演算法:<code>NaN</code> 被認為與 <code>NaN</code> 相同(即使 <code>NaN !== NaN</code>)並且根據 <code>===</code> 運算符的語義,所有其他值都被認為相等。在目前的ECMAScript 規範中,<code>-0</code> 和 <code>+0</code> 被認為是相等的,儘管在早期的草案中並非如此。詳細的內容請參閱 {{anch("Browser compatibility")}} 表中的 "Value equality for -0 and 0"。</p>
+
+<h3 id="Object_及_Map_的比較">Object 及 Map 的比較</h3>
+
+<p>{{jsxref("Object")}} 和 <code>Map</code> 類似。兩者都允許你設置對應的鍵值對,檢索這些值,刪除鍵,並檢測是否有什麼存儲在鍵中。正因為如此(也因為沒有內置的替代品),<code>Object</code> 在歷史上一直被當作 <code>Map</code> 使用;然而在某些情況下,使用 <code>Map</code> 有一些重要的不同之處:</p>
+
+<ul>
+ <li><code>Object</code> 的鍵是 {{jsxref("String", "字串")}} 和 {{jsxref("Symbol", "Symbol")}},而它們在 <code>Map</code> 中可以是任意的資料型態,包括函數,對象以及原始的資料型態。</li>
+ <li>你可以使用 <code>size</code> 屬性輕鬆地獲得 <code>Map</code> 的大小,而 <code>Object</code> 中的屬性數量必須手動確認。</li>
+ <li><code>Map</code> 是可迭代(<a href="/en-US/docs/Web/JavaScript/Guide/iterable">iterable</a>)的,因此可以直接迭代,而在 <code>Object</code> 上迭代則需要以某種方式獲取其鍵並對其進行迭代。</li>
+ <li><code>Object</code> 有一個原型,所以如果不小心,映射中有一些默認鍵可能與鍵發生衝突。從 ES5 開始,這可以通過使用 <code>map = Object.create(null)</code> 來繞過這個問題,但是很少這樣做。</li>
+ <li>在涉及頻繁添加和刪除鍵值對的場景中,<code>Map</code> 可能表現得更好。</li>
+</ul>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Map.length</code></dt>
+ <dd><code>length</code>屬性的值為 0<br>
+ 要計算 <code>Map</code> 中有多少元素,可以使用 {{jsxref("Map.prototype.size")}}。</dd>
+ <dt>{{jsxref("Map.@@species", "get Map[@@species]")}}</dt>
+ <dd>用於創建派生物件的構造函數。</dd>
+ <dt>{{jsxref("Map.prototype")}}</dt>
+ <dd>表示 <code>Map</code> 構造函數的原型,允許對所有的 <code>Map</code> 物件添加屬性</dd>
+</dl>
+
+<h2 id="Map_物件實體"><code>Map</code> 物件實體</h2>
+
+<p>所有的 <code>Map</code> 實例都繼承自 {{jsxref("Map.prototype")}}.</p>
+
+<h3 id="屬性_2">屬性</h3>
+
+<p>{{page('zh-TW/Web/JavaScript/Reference/Global_Objects/Map/prototype','Properties')}}</p>
+
+<h3 id="方法">方法</h3>
+
+<p>{{page('zh-TW/Web/JavaScript/Reference/Global_Objects/Map/prototype','Methods')}}</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Map_物件">使用 <code>Map</code> 物件</h3>
+
+<pre class="brush: js">var myMap = new Map();
+
+var keyString = 'a string',
+ keyObj = {},
+ keyFunc = function() {};
+
+// setting the values
+myMap.set(keyString, "value associated with 'a string'");
+myMap.set(keyObj, 'value associated with keyObj');
+myMap.set(keyFunc, 'value associated with keyFunc');
+
+myMap.size; // 3
+
+// getting the values
+myMap.get(keyString); // "value associated with 'a string'"
+myMap.get(keyObj); // "value associated with keyObj"
+myMap.get(keyFunc); // "value associated with keyFunc"
+
+myMap.get('a string'); // "value associated with 'a string'"
+ // because keyString === 'a string'
+myMap.get({}); // undefined, because keyObj !== {}
+myMap.get(function() {}) // undefined, because keyFunc !== function () {}
+</pre>
+
+<h3 id="使用_NaN_作為_Map_的鍵">使用 <code>NaN</code> 作為 <code>Map</code> 的鍵</h3>
+
+<p><code>NaN</code> 同樣可以作為 <code>Map</code> 的 key,雖然每個 <code>NaN</code> 都不等於自己本身,下面的例子是有效的,因為 <code>NaN</code> 無法區分彼此。</p>
+
+<pre class="brush: js">var myMap = new Map();
+myMap.set(NaN, 'not a number');
+
+myMap.get(NaN); // "not a number"
+
+var otherNaN = Number('foo');
+myMap.get(otherNaN); // "not a number"
+</pre>
+
+<h3 id="透過_for..of_迭代_Map">透過 <code>for..of</code> 迭代 <code>Map</code></h3>
+
+<p>Map 可以使用 <code>for..of</code> 迴圈進行迭代:</p>
+
+<pre class="brush: js">var myMap = new Map();
+myMap.set(0, 'zero');
+myMap.set(1, 'one');
+for (var [key, value] of myMap) {
+ console.log(key + ' = ' + value);
+}
+// 0 = zero
+// 1 = one
+
+for (var key of myMap.keys()) {
+ console.log(key);
+}
+// 0
+// 1
+
+for (var value of myMap.values()) {
+ console.log(value);
+}
+// zero
+// one
+
+for (var [key, value] of myMap.entries()) {
+ console.log(key + ' = ' + value);
+}
+// 0 = zero
+// 1 = one
+</pre>
+
+<h3 id="透過_forEach_迭代_Map">透過 <code>forEach()</code> 迭代 <code>Map</code></h3>
+
+<p><code>Map</code> 可以使用 <code>forEach()</code> 方法進行迭代:</p>
+
+<pre class="brush: js">myMap.forEach(function(value, key) {
+ console.log(key + ' = ' + value);
+});
+// Will show 2 logs; first with "0 = zero" and second with "1 = one"
+</pre>
+
+<h3 id="與_Array_物件關聯">與 <code>Array</code> 物件關聯</h3>
+
+<pre class="brush: js">var kvArray = [['key1', 'value1'], ['key2', 'value2']];
+
+// Use the regular Map constructor to transform a 2D key-value Array into a map
+var myMap = new Map(kvArray);
+
+myMap.get('key1'); // returns "value1"
+
+// Use the Array.from function to transform a map into a 2D key-value Array
+console.log(Array.from(myMap)); // Will show you exactly the same Array as kvArray
+
+// Or use the keys or values iterators and convert them to an array
+console.log(Array.from(myMap.keys())); // Will show ["key1", "key2"]
+</pre>
+
+
+
+<h3 id="複製與合併_Map"> 複製與合併 <code>Map</code></h3>
+
+<p>就像 <code>Array</code> 一樣,<code>Map</code> 可以被複製:</p>
+
+<pre><code>var original = new Map([
+ [1, 'one']
+]);
+
+var clone = new Map(original);
+
+console.log(clone.get(1)); // one
+console.log(original === clone); // false. Useful for shallow comparison</code></pre>
+
+<p>請記住,數據本身並非克隆的。</p>
+
+<p><code>Map</code> 可以被合併,保持鍵的唯一性:</p>
+
+<pre><code>var first = new Map([
+ [1, 'one'],
+ [2, 'two'],
+ [3, 'three'],
+]);
+
+var second = new Map([
+ [1, 'uno'],
+ [2, 'dos']
+]);
+
+// Merge two maps. The last repeated key wins.
+// Spread operator essentially converts a Map to an Array
+var merged = new Map([...first, ...second]);
+
+console.log(merged.get(1)); // uno
+console.log(merged.get(2)); // dos
+console.log(merged.get(3)); // three</code></pre>
+
+<p><code>Map</code> 也可以跟 <code>Array</code> 合併:</p>
+
+<pre><code>var first = new Map([
+ [1, 'one'],
+ [2, 'two'],
+ [3, 'three'],
+]);
+
+var second = new Map([
+ [1, 'uno'],
+ [2, 'dos']
+]);
+
+// Merge maps with an array. The last repeated key wins.
+var merged = new Map([...first, ...second, [1, 'eins']]);
+
+console.log(merged.get(1)); // eins
+console.log(merged.get(2)); // dos
+console.log(merged.get(3)); // three</code>
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-map-objects', 'Map')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-map-objects', 'Map')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Map")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=697479">Map and Set bug at Mozilla</a></li>
+ <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets">ECMAScript Harmony proposal</a></li>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("WeakMap")}}</li>
+ <li>{{jsxref("WeakSet")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/abs/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/abs/index.html
new file mode 100644
index 0000000000..91be97bc11
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/abs/index.html
@@ -0,0 +1,104 @@
+---
+title: Math.abs()
+slug: Web/JavaScript/Reference/Global_Objects/Math/abs
+tags:
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/abs
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.abs()</code></strong> 函式會回傳一個數字的絕對值,即為:</p>
+
+<p><math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.abs</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mrow><mo stretchy="false">|</mo><mi>x</mi><mo stretchy="false">|</mo></mrow><mo>=</mo><mrow><mo>{</mo><mtable columnalign="left left"><mtr><mtd><mi>x</mi></mtd><mtd><mtext>if</mtext><mspace width="1em"></mspace><mi>x</mi><mo>&gt;</mo><mn>0</mn></mtd></mtr><mtr><mtd><mi>0</mi></mtd><mtd><mtext>if</mtext><mspace width="1em"></mspace><mi>x</mi><mo>=</mo><mn>0</mn></mtd></mtr><mtr><mtd><mo>-</mo><mi>x</mi></mtd><mtd><mtext>if</mtext><mspace width="1em"></mspace><mi>x</mi><mo>&lt;</mo><mn>0</mn></mtd></mtr></mtable></mrow></mrow><annotation encoding="TeX">{\mathtt{\operatorname{Math.abs}(x)}} = {|x|} = \begin{cases} x &amp; \text{if} \quad x \geq 0 \\ x &amp; \text{if} \quad x &lt; 0 \end{cases} </annotation></semantics></math></p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-abs.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">Math.abs(<var>x</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>一個數字。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>給定數字的絕對值。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>Because <code>abs()</code> is a static method of <code>Math</code>, you always use it as <code>Math.abs()</code>, rather than as a method of a <code>Math</code> object you created (<code>Math</code> is not a constructor).</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Math.abs()_的行為"><code>Math.abs()</code> 的行為</h3>
+
+<p>Passing an empty object, an array with more than one member, a non-numeric string or {{jsxref("undefined")}}/empty variable returns {{jsxref("NaN")}}. Passing {{jsxref("null")}}, an empty string or an empty array returns 0.</p>
+
+<pre class="brush: js" dir="rtl">Math.abs('-1'); // 1
+Math.abs(-2); // 2
+Math.abs(null); // 0
+Math.abs(''); // 0
+Math.abs([]); // 0
+Math.abs([2]); // 2
+Math.abs([1,2]); // NaN
+Math.abs({}); // NaN
+Math.abs('string'); // NaN
+Math.abs(); // NaN
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.1', 'Math.abs')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.abs', 'Math.abs')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.abs', 'Math.abs')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.abs")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.ceil()")}}</li>
+ <li>{{jsxref("Math.floor()")}}</li>
+ <li>{{jsxref("Math.round()")}}</li>
+ <li>{{jsxref("Math.sign()")}}</li>
+ <li>{{jsxref("Math.trunc()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/ceil/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/ceil/index.html
new file mode 100644
index 0000000000..7ce7174f0b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/ceil/index.html
@@ -0,0 +1,170 @@
+---
+title: Math.ceil()
+slug: Web/JavaScript/Reference/Global_Objects/Math/ceil
+tags:
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/ceil
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.ceil()</code></strong> 函式會回傳大於等於所給數字的最小整數。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-ceil.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Math.ceil(<var>x</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>一個數字。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個大於等於指定數字的最小整數。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>Because <code>ceil()</code> is a static method of <code>Math</code>, you always use it as <code>Math.ceil()</code>, rather than as a method of a <code>Math</code> object you created (<code>Math</code> is not a constructor).</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Math.ceil()">使用 <code>Math.ceil()</code></h3>
+
+<p>The following example shows example usage of <code>Math.ceil()</code>.</p>
+
+<pre class="brush: js">Math.ceil(.95); // 1
+Math.ceil(4); // 4
+Math.ceil(7.004); // 8
+Math.ceil(-0.95); // -0
+Math.ceil(-4); // -4
+Math.ceil(-7.004); // -7
+</pre>
+
+<h3 id="Decimal_adjustment">Decimal adjustment</h3>
+
+<pre class="brush: js">// Closure
+(function() {
+ /**
+ * Decimal adjustment of a number.
+ *
+ * @param {String} type The type of adjustment.
+ * @param {Number} value The number.
+ * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
+ * @returns {Number} The adjusted value.
+ */
+ function decimalAdjust(type, value, exp) {
+ // If the exp is undefined or zero...
+ if (typeof exp === 'undefined' || +exp === 0) {
+ return Math[type](value);
+ }
+ value = +value;
+ exp = +exp;
+ // If the value is not a number or the exp is not an integer...
+ if (isNaN(value) || !(typeof exp === 'number' &amp;&amp; exp % 1 === 0)) {
+ return NaN;
+ }
+ // Shift
+ value = value.toString().split('e');
+ value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
+ // Shift back
+ value = value.toString().split('e');
+ return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
+ }
+
+ // Decimal round
+ if (!Math.round10) {
+ Math.round10 = function(value, exp) {
+ return decimalAdjust('round', value, exp);
+ };
+ }
+ // Decimal floor
+ if (!Math.floor10) {
+ Math.floor10 = function(value, exp) {
+ return decimalAdjust('floor', value, exp);
+ };
+ }
+ // Decimal ceil
+ if (!Math.ceil10) {
+ Math.ceil10 = function(value, exp) {
+ return decimalAdjust('ceil', value, exp);
+ };
+ }
+})();
+
+// Round
+Math.round10(55.55, -1); // 55.6
+Math.round10(55.549, -1); // 55.5
+Math.round10(55, 1); // 60
+Math.round10(54.9, 1); // 50
+Math.round10(-55.55, -1); // -55.5
+Math.round10(-55.551, -1); // -55.6
+Math.round10(-55, 1); // -50
+Math.round10(-55.1, 1); // -60
+// Floor
+Math.floor10(55.59, -1); // 55.5
+Math.floor10(59, 1); // 50
+Math.floor10(-55.51, -1); // -55.6
+Math.floor10(-51, 1); // -60
+// Ceil
+Math.ceil10(55.51, -1); // 55.6
+Math.ceil10(51, 1); // 60
+Math.ceil10(-55.59, -1); // -55.5
+Math.ceil10(-59, 1); // -50
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.6', 'Math.ceil')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.ceil', 'Math.ceil')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.ceil', 'Math.ceil')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.ceil")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.abs()")}}</li>
+ <li>{{jsxref("Math.floor()")}}</li>
+ <li>{{jsxref("Math.round()")}}</li>
+ <li>{{jsxref("Math.sign()")}}</li>
+ <li>{{jsxref("Math.trunc()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/floor/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/floor/index.html
new file mode 100644
index 0000000000..5587d60838
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/floor/index.html
@@ -0,0 +1,169 @@
+---
+title: Math.floor()
+slug: Web/JavaScript/Reference/Global_Objects/Math/floor
+tags:
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/floor
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.floor()</code></strong> 函式會回傳小於等於所給數字的最大整數。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-floor.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Math.floor(<var>x</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>數字型態。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>小於等於所給數字的最大整數。</p>
+
+<h2 id="描述">描述</h2>
+
+<p> <code>floor()</code> 是 <code>Math</code>的靜態函式, 所以不需實體化<code>Math</code> 物件, 只要直接呼叫 <code>Math.floor()</code>就能使用。</p>
+
+<p>(此外<code>Math</code> 並不是建構子).</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Math.floor">使用 <code>Math.floor()</code></h3>
+
+<pre class="brush: js">Math.floor( 45.95); // 45
+Math.floor( 45.05); // 45
+Math.floor( 4 ); // 4
+Math.floor(-45.05); // -46
+Math.floor(-45.95); // -46
+</pre>
+
+<h3 id="Decimal_adjustment">Decimal adjustment</h3>
+
+<pre class="brush: js">// Closure
+(function() {
+ /**
+ * Decimal adjustment of a number.
+ *
+ * @param {String} type The type of adjustment.
+ * @param {Number} value The number.
+ * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
+ * @returns {Number} The adjusted value.
+ */
+ function decimalAdjust(type, value, exp) {
+ // If the exp is undefined or zero...
+ if (typeof exp === 'undefined' || +exp === 0) {
+ return Math[type](value);
+ }
+ value = +value;
+ exp = +exp;
+ // If the value is not a number or the exp is not an integer...
+ if (isNaN(value) || !(typeof exp === 'number' &amp;&amp; exp % 1 === 0)) {
+ return NaN;
+ }
+ // Shift
+ value = value.toString().split('e');
+ value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
+ // Shift back
+ value = value.toString().split('e');
+ return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
+ }
+
+ // Decimal round
+ if (!Math.round10) {
+ Math.round10 = function(value, exp) {
+ return decimalAdjust('round', value, exp);
+ };
+ }
+ // Decimal floor
+ if (!Math.floor10) {
+ Math.floor10 = function(value, exp) {
+ return decimalAdjust('floor', value, exp);
+ };
+ }
+ // Decimal ceil
+ if (!Math.ceil10) {
+ Math.ceil10 = function(value, exp) {
+ return decimalAdjust('ceil', value, exp);
+ };
+ }
+})();
+
+// Round
+Math.round10(55.55, -1); // 55.6
+Math.round10(55.549, -1); // 55.5
+Math.round10(55, 1); // 60
+Math.round10(54.9, 1); // 50
+Math.round10(-55.55, -1); // -55.5
+Math.round10(-55.551, -1); // -55.6
+Math.round10(-55, 1); // -50
+Math.round10(-55.1, 1); // -60
+// Floor
+Math.floor10(55.59, -1); // 55.5
+Math.floor10(59, 1); // 50
+Math.floor10(-55.51, -1); // -55.6
+Math.floor10(-51, 1); // -60
+// Ceil
+Math.ceil10(55.51, -1); // 55.6
+Math.ceil10(51, 1); // 60
+Math.ceil10(-55.59, -1); // -55.5
+Math.ceil10(-59, 1); // -50
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.9', 'Math.floor')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.floor', 'Math.floor')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.floor', 'Math.floor')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.floor")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.abs()")}}</li>
+ <li>{{jsxref("Math.ceil()")}}</li>
+ <li>{{jsxref("Math.round()")}}</li>
+ <li>{{jsxref("Math.sign()")}}</li>
+ <li>{{jsxref("Math.trunc()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/index.html
new file mode 100644
index 0000000000..c67999150e
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/index.html
@@ -0,0 +1,196 @@
+---
+title: Math
+slug: Web/JavaScript/Reference/Global_Objects/Math
+tags:
+ - JavaScript
+ - Math
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/Math
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math</code></strong> 是一個擁有數學常數及數學函數(非函式物件)屬性及方法的內建物件。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>不像其他的全域物件,<code>Math</code> 並非建構函式。所有 <code>Math</code> 的屬性及方法皆為靜態。你可以使用 <code>Math.PI</code> 來參考到圓周率 pi 的常數值,以及可以呼叫 <code>Math.sin(x)</code> 函式來計算三角函數正弦曲線 sine(<code>x</code> 為方法的引數)。常數是由 JavaScript 中實數的完整精度來定義。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Math.E")}}</dt>
+ <dd>歐拉常數 (此指自然常數) ,也是自然對數的底數,約為2.718。</dd>
+ <dt>{{jsxref("Math.LN2")}}</dt>
+ <dd>2 的自然對數,約為0.693。</dd>
+ <dt>{{jsxref("Math.LN10")}}</dt>
+ <dd>10 的自然對數,約為2.303。</dd>
+ <dt>{{jsxref("Math.LOG2E")}}</dt>
+ <dd>以 2 為底的 E 的對數,約為1.443。</dd>
+ <dt>{{jsxref("Math.LOG10E")}}</dt>
+ <dd>以 10 為底的 E 的對數,約為0.434。</dd>
+ <dt>{{jsxref("Math.PI")}}</dt>
+ <dd>一個圓的圓周和其直徑比值,約為 3.14159。</dd>
+ <dt>{{jsxref("Math.SQRT1_2")}}</dt>
+ <dd>1/2的平方根;也就是1除以2的平方根,約為 0.707。</dd>
+ <dt>{{jsxref("Math.SQRT2")}}</dt>
+ <dd>2的平方根,約為 1.414。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<div class="note">
+<p>注意三角函數 <span style="font-size: 1rem; letter-spacing: -0.00278rem;">(</span><code style="font-style: normal; letter-spacing: -0.00278rem;">sin()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">cos()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">tan()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">asin()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">acos()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">atan()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">, </span><code style="font-style: normal; letter-spacing: -0.00278rem;">atan2()</code><span style="font-size: 1rem; letter-spacing: -0.00278rem;">) 的參數或回傳值的角度皆以弧度為單位。把角度乘上 </span><code style="font-style: normal; letter-spacing: -0.00278rem;">(Math.PI / 180)</code> 會得到弧度單位,將弧度除以該數則會轉換回一般所用的角度單位。</p>
+</div>
+
+<div class="note">
+<p>注意許多數學方法的精度是取決於實作方式的。這意味著不同的瀏覽器可能會得到不同的結果,甚至同一個 JS引擎在不同的作業系統或架構上所得到的結果都有可能相異。</p>
+</div>
+
+<dl>
+ <dt>{{jsxref("Global_Objects/Math/abs", "Math.abs(x)")}}</dt>
+ <dd>回傳 x 的絕對值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/acos", "Math.acos(x)")}}</dt>
+ <dd>回傳 x 的反餘弦值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/acosh", "Math.acosh(x)")}}</dt>
+ <dd>Returns the hyperbolic arccosine of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/asin", "Math.asin(x)")}}</dt>
+ <dd>回傳 x 的反正弦值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/asinh", "Math.asinh(x)")}}</dt>
+ <dd>Returns the hyperbolic arcsine of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/atan", "Math.atan(x)")}}</dt>
+ <dd>回傳 x 的反正切值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/atanh", "Math.atanh(x)")}}</dt>
+ <dd>Returns the hyperbolic arctangent of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/atan2", "Math.atan2(y, x)")}}</dt>
+ <dd>Returns the arctangent of the quotient of its arguments.</dd>
+ <dt>{{jsxref("Global_Objects/Math/cbrt", "Math.cbrt(x)")}}</dt>
+ <dd>回傳 x 的立方根值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/ceil", "Math.ceil(x)")}}</dt>
+ <dd>回傳不小於 x 的最小整數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/clz32", "Math.clz32(x)")}}</dt>
+ <dd>Returns the number of leading zeroes of a 32-bit integer.</dd>
+ <dt>{{jsxref("Global_Objects/Math/cos", "Math.cos(x)")}}</dt>
+ <dd>回傳 x 的餘弦值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/cosh", "Math.cosh(x)")}}</dt>
+ <dd>Returns the hyperbolic cosine of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/exp", "Math.exp(x)")}}</dt>
+ <dd>回傳 E<sup>x</sup>,x 為給定數值,E 為歐拉常數 (自然對數的底數)。</dd>
+ <dt>{{jsxref("Global_Objects/Math/expm1", "Math.expm1(x)")}}</dt>
+ <dd>回傳 <code>exp(x)</code> 減去1的值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/floor", "Math.floor(x)")}}</dt>
+ <dd>回傳不大於 x 的最大整數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/fround", "Math.fround(x)")}}</dt>
+ <dd>Returns the nearest <a href="http://en.wikipedia.org/wiki/Single-precision_floating-point_format" title="link to the wikipedia page on single precision">single precision</a> float representation of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/hypot", "Math.hypot([x[, y[, …]]])")}}</dt>
+ <dd>回傳參數平方之和的平方根。</dd>
+ <dt>{{jsxref("Global_Objects/Math/imul", "Math.imul(x, y)")}}</dt>
+ <dd>Returns the result of a 32-bit integer multiplication.</dd>
+ <dt>{{jsxref("Global_Objects/Math/log", "Math.log(x)")}}</dt>
+ <dd>回傳 x 的自然對數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/log1p", "Math.log1p(x)")}}</dt>
+ <dd>回傳 <code>1 + x</code> 的自然對數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/log10", "Math.log10(x)")}}</dt>
+ <dd>回傳以 10 為底,x 的對數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/log2", "Math.log2(x)")}}</dt>
+ <dd>回傳以 2 為底,x 的對數值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/max", "Math.max([x[, y[, …]]])")}}</dt>
+ <dd>回傳給定數值中的最大值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/min", "Math.min([x[, y[, …]]])")}}</dt>
+ <dd>回傳給定數值中的最小值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/pow", "Math.pow(x, y)")}}</dt>
+ <dd>回傳 x 的 y 次方,也就是 <code>x<sup>y</sup></code>。</dd>
+ <dt>{{jsxref("Global_Objects/Math/random", "Math.random()")}}</dt>
+ <dd>回傳一個 0 到 1 之間的偽隨機值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/round", "Math.round(x)")}}</dt>
+ <dd>回傳 x 的四捨五入值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/sign", "Math.sign(x)")}}</dt>
+ <dd>回傳 x 的正負號,也就是回傳 x 的正負。</dd>
+ <dt>{{jsxref("Global_Objects/Math/sin", "Math.sin(x)")}}</dt>
+ <dd>回傳 x 的正弦值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/sinh", "Math.sinh(x)")}}</dt>
+ <dd>Returns the hyperbolic sine of a number.</dd>
+ <dt>{{jsxref("Global_Objects/Math/sqrt", "Math.sqrt(x)")}}</dt>
+ <dd>回傳 x 的正平方根。</dd>
+ <dt>{{jsxref("Global_Objects/Math/tan", "Math.tan(x)")}}</dt>
+ <dd>回傳 x 的正切值。</dd>
+ <dt>{{jsxref("Global_Objects/Math/tanh", "Math.tanh(x)")}}</dt>
+ <dd>Returns the hyperbolic tangent of a number.</dd>
+ <dt><code>Math.toSource()</code> {{non-standard_inline}}</dt>
+ <dd>回傳字串 <code>"Math"</code>。</dd>
+ <dt>{{jsxref("Global_Objects/Math/trunc", "Math.trunc(x)")}}</dt>
+ <dd>Returns the integral part of the number x, removing any fractional digits.</dd>
+</dl>
+
+<h2 id="擴充_Math_物件">擴充 <code>Math</code> 物件</h2>
+
+<p>As most of the built-in objects in JavaScript, the <code>Math</code> object can be extended with custom properties and methods. To extend the <code>Math</code> object, you do not use 'prototype'. Instead, you directly extend <code>Math</code>:</p>
+
+<pre>Math.propName = propValue;
+Math.methodName = methodRef;</pre>
+
+<p>For instance, the following example adds a method to the <code>Math</code> object for calculating the <em>greatest common divisor</em> of a list of arguments.</p>
+
+<pre class="brush: js">/* Variadic function -- Returns the greatest common divisor of a list of arguments */
+Math.gcd = function() {
+ if (arguments.length == 2) {
+ if (arguments[1] == 0)
+ return arguments[0];
+ else
+ return Math.gcd(arguments[1], arguments[0] % arguments[1]);
+ } else if (arguments.length &gt; 2) {
+ var result = Math.gcd(arguments[0], arguments[1]);
+ for (var i = 2; i &lt; arguments.length; i++)
+ result = Math.gcd(result, arguments[i]);
+ return result;
+ }
+};</pre>
+
+<p>Try it:</p>
+
+<pre class="brush: js">console.log(Math.gcd(20, 30, 15, 70, 40)); // `5`</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8', 'Math')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math-object', 'Math')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>New methods {{jsxref("Math.log10()", "log10()")}}, {{jsxref("Math.log2()", "log2()")}}, {{jsxref("Math.log1p()", "log1p()")}}, {{jsxref("Math.expm1()", "expm1()")}}, {{jsxref("Math.cosh()", "cosh()")}}, {{jsxref("Math.sinh()", "sinh()")}}, {{jsxref("Math.tanh()", "tanh()")}}, {{jsxref("Math.acosh()", "acosh()")}}, {{jsxref("Math.asinh()", "asinh()")}}, {{jsxref("Math.atanh()", "atanh()")}}, {{jsxref("Math.hypot()", "hypot()")}}, {{jsxref("Math.trunc()", "trunc()")}}, {{jsxref("Math.sign()", "sign()")}}, {{jsxref("Math.imul()", "imul()")}}, {{jsxref("Math.fround()", "fround()")}}, {{jsxref("Math.cbrt()", "cbrt()")}} and {{jsxref("Math.clz32()", "clz32()")}} added.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math-object', 'Math')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Number")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html
new file mode 100644
index 0000000000..1f53898090
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/max/index.html
@@ -0,0 +1,117 @@
+---
+title: Math.max()
+slug: Web/JavaScript/Reference/Global_Objects/Math/max
+tags:
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/max
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.max()</code></strong> 函式會回傳零或多個數字中的最大值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/math-max.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Math.max([<var>value1</var>[, <var>value2</var>[, ...]]])</code></pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>value1, value2, ...</code></dt>
+ <dd>Numbers.</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>The largest of the given numbers. If at least one of the arguments cannot be converted to a number, {{jsxref("NaN")}} is returned.</p>
+
+<h2 id="說明">說明</h2>
+
+<p>Because <code>max()</code> is a static method of <code>Math</code>, you always use it as <code>Math.max()</code>, rather than as a method of a <code>Math</code> object you created (<code>Math</code> is not a constructor).</p>
+
+<p>If no arguments are given, the result is -{{jsxref("Infinity")}}.</p>
+
+<p>If at least one of arguments cannot be converted to a number, the result is {{jsxref("NaN")}}.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_Math.max()">Using <code>Math.max()</code></h3>
+
+<pre class="brush: js">Math.max(10, 20); // 20
+Math.max(-10, -20); // -10
+Math.max(-10, 20); // 20
+</pre>
+
+<h4 id="Getting_the_maximum_element_of_an_array">Getting the maximum element of an array</h4>
+
+<p>{{jsxref("Array.prototype.reduce", "Array.reduce()")}} can be used to find the maximum element in a numeric array, by comparing each value:</p>
+
+<pre class="brush: js">var arr = [1,2,3];
+var max = arr.reduce(function(a, b) {
+  return Math.max(a, b);
+});
+</pre>
+
+<p>The following function uses {{jsxref("Function.prototype.apply()")}} to get the maximum of an array. <code>getMaxOfArray([1, 2, 3])</code> is equivalent to <code>Math.max(1, 2, 3)</code>, but you can use <code>getMaxOfArray()</code> on programmatically constructed arrays. This should only be used for arrays with relatively few elements.</p>
+
+<pre class="brush: js">function getMaxOfArray(numArray) {
+ return Math.max.apply(null, numArray);
+}</pre>
+
+<p>The new <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator">spread operator</a> is a shorter way of writing the <code>apply</code> solution to get the maximum of an array:</p>
+
+<pre class="brush: js">var arr = [1, 2, 3];
+var max = Math.max(...arr);
+</pre>
+
+<p>However, both spread (<code>...</code>) and <code>apply</code> will either fail or return the wrong result if the array has too many elements, because they try to pass the array elements as function parameters. See <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply#Using_apply_and_built-in_functions">Using <code>apply</code> and built-in functions</a> for more details. The <code>reduce</code> solution does not have this problem.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.11', 'Math.max')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.max', 'Math.max')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.max', 'Math.max')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.max")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.min()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/pow/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/pow/index.html
new file mode 100644
index 0000000000..00ccb041ae
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/pow/index.html
@@ -0,0 +1,107 @@
+---
+title: Math.pow()
+slug: Web/JavaScript/Reference/Global_Objects/Math/pow
+tags:
+ - 次方
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.pow()</code></strong> 函式回傳 <code>base</code> 的 <code>exponent</code> 次方(幂)值,也就是 <code>base<sup>exponent</sup></code>。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate"><code>Math.pow(<var>base</var>, <var>exponent</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>base</code></dt>
+ <dd>基數。</dd>
+ <dt><code>exponent</code></dt>
+ <dd>要乘上 <code>base</code> 幾次的指數。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A number representing the given base taken to the power of the given exponent.</p>
+
+<h2 id="敘述">敘述</h2>
+
+<p>The <strong><code>Math.pow()</code></strong> function returns the <code>base</code> to the <code>exponent</code> power, that is, <code>base<sup>exponent</sup></code>, the base and the exponent are in decimal numeral system.</p>
+
+<p>由於 <code>pow()</code> 是 <code>Math</code> 的靜態方法,you always use it as <code>Math.pow()</code>, rather than as a method of a <code>Math</code> object you created(<code>Math</code> 並沒有建構子)。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="使用_Math.pow">使用 <code>Math.pow()</code></h3>
+
+<pre class="brush: js notranslate">// simple
+Math.pow(7, 2); // 49
+Math.pow(7, 3); // 343
+Math.pow(2, 10); // 1024
+// fractional exponents
+Math.pow(4, 0.5); // 2 (4 的平方根)
+Math.pow(8, 1/3); // 2 (8 的立方根)
+Math.pow(2, 0.5); // 1.4142135623730951 (2 的平方根)
+Math.pow(2, 1/3); // 1.2599210498948732 (2 的立方根)
+// signed exponents
+Math.pow(7, -2); // 0.02040816326530612 (1/49)
+Math.pow(8, -1/3); // 0.5
+// signed bases
+Math.pow(-7, 2); // 49 (負負得正,2次方都是正數)
+Math.pow(-7, 3); // -343 (3次方有可能為負數)
+Math.pow(-7, 0.5); // NaN (負數沒辦法得出一個實數平方根)
+// due to "even" and "odd" roots laying close to each other,
+// and limits in the floating number precision,
+// negative bases with fractional exponents always return NaN
+Math.pow(-7, 1/3); // NaN
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.13', 'Math.pow')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.pow', 'Math.pow')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.pow', 'Math.pow')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.pow")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.cbrt()")}}</li>
+ <li>{{jsxref("Math.exp()")}}</li>
+ <li>{{jsxref("Math.log()")}}</li>
+ <li>{{jsxref("Math.sqrt()")}}</li>
+ <li><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation" title="Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).">Exponentiation operator</a> {{experimental_inline}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html
new file mode 100644
index 0000000000..4f7b65f844
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/random/index.html
@@ -0,0 +1,95 @@
+---
+title: Math.random()
+slug: Web/JavaScript/Reference/Global_Objects/Math/random
+tags:
+ - 浮點數
+ - 隨機
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/random
+---
+<div>{{JSRef}}</div>
+
+<p>函數 <strong><code>Math.random()</code></strong> 會回傳一個偽隨機小數 (pseudo-random) 介於0到1之間(包含 0,不包含1) ,大致符合數學與統計上的均勻分佈 (uniform distribution) ,您可以選定想要的數字區間,它會透過演算法被產生並且不允許使用者自行跳選或重設成特定數字。{{EmbedInteractiveExample("pages/js/math-random.html")}}</p>
+
+<div class="note">
+<p><code>Math.random()</code> 所產生的偽隨機小數不符合加密學安全性要求。<em>請勿使用於任何加密、資安相關領域。</em></p>
+
+<p><em>如有加密需求建議參考Web Crypto API</em><a href="/en-US/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">Math.random()</pre>
+
+<h3 id="回傳值_Return_value">回傳值 Return value</h3>
+
+<p>回傳一個偽隨機小數 (pseudo-random),小數也稱浮點數; 介於0到1之間(包含 0,不包含1) 。</p>
+
+<h2 id="範例">範例</h2>
+
+<p>請留意JavaScript中的數字與許多語言一樣使用 IEEE 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for <code>Math.random()</code> itself) aren't exact. If extremely large bounds are chosen (2<sup>53</sup> or higher), it's possible in <em>extremely</em> rare cases to calculate the usually-excluded upper bound.</p>
+
+<h3 id="Getting_a_random_number_between_0_inclusive_and_1_exclusive">Getting a random number between 0 (inclusive) and 1 (exclusive)</h3>
+
+<pre class="brush: js notranslate">function getRandom() {
+ return Math.random();
+}
+</pre>
+
+<h3 id="Getting_a_random_number_between_two_values">Getting a random number between two values</h3>
+
+<p>This example returns a random number between the specified values. The returned value is no lower than (and may possibly equal) <code>min</code>, and is less than (and not equal) <code>max</code>.</p>
+
+<pre class="brush: js notranslate">function getRandomArbitrary(min, max) {
+ return Math.random() * (max - min) + min;
+}
+</pre>
+
+<h3 id="Getting_a_random_integer_between_two_values">Getting a random integer between two values</h3>
+
+<p>This example returns a random <em>integer</em> between the specified values. The value is no lower than <code>min</code> (or the next integer greater than <code>min</code> if <code>min</code> isn't an integer), and is less than (but not equal to) <code>max</code>.</p>
+
+<pre class="brush: js notranslate">function getRandomInt(min, max) {
+  min = Math.ceil(min);
+  max = Math.floor(max);
+ return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
+}
+</pre>
+
+<div class="note">
+<p>It might be tempting to use <code>Math.round()</code> to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.</p>
+</div>
+
+<h3 id="Getting_a_random_integer_between_two_values_inclusive">Getting a random integer between two values, inclusive</h3>
+
+<p>While the <code>getRandomInt()</code> function above is inclusive at the minimum, it's exclusive at the maximum. What if you need the results to be inclusive at both the minimum and the maximum? The <code>getRandomIntInclusive()</code> function below accomplishes that.</p>
+
+<pre class="brush: js notranslate">function getRandomIntInclusive(min, max) {
+  min = Math.ceil(min);
+  max = Math.floor(max);
+ return Math.floor(Math.random() * (max - min + 1) + min); //The maximum is inclusive and the minimum is inclusive
+}</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-math.random', 'Math.random')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Math.random")}}</p>
+
+<h2 class="countTop" id="其他參考資料">其他參考資料</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/RandomSource/getRandomValues" title="The documentation about this has not yet been written; please consider contributing!"><code>window.crypto.getRandomValues()</code></a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html b/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html
new file mode 100644
index 0000000000..5e6a0ea694
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/math/round/index.html
@@ -0,0 +1,212 @@
+---
+title: Math.round()
+slug: Web/JavaScript/Reference/Global_Objects/Math/round
+tags:
+ - JavaScript
+ - Math
+ - Method
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Math/round
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Math.round()</code></strong> 函數回傳四捨五入後的近似值.</p>
+
+<h2 id="表達式">表達式</h2>
+
+<pre class="syntaxbox"><code>Math.round(<var>x</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>x</code></dt>
+ <dd>數字.</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>如果小數位的部分值大於 0.5, 這個值將會進位. 如果小數位的部分值小於 0.5, 這個值將不會進位.</p>
+
+<p>由於 <code>round()</code> 是靜態的方法, 所以總是得這樣使用 <code>Math.round()</code>, 而非作為 <code>Math</code> 物件的一個方法 (<code>Math</code>並沒有建構子).</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Math.round()">使用 <code>Math.round()</code></h3>
+
+<pre class="brush: js">// Returns the value 20
+x = Math.round(20.49);
+
+// Returns the value 21
+x = Math.round(20.5);
+
+// Returns the value -20
+x = Math.round(-20.5);
+
+// Returns the value -21
+x = Math.round(-20.51);
+
+// Returns the value 1 (!)
+// Note the rounding error because of inaccurate floating point arithmetics
+// Compare this with Math.round10(1.005, -2) from the example below
+x = Math.round(1.005*100)/100;
+</pre>
+
+<h3 id="十進位近似值">十進位近似值</h3>
+
+<pre class="brush: js">// 閉包含數
+(function() {
+ /**
+ * Decimal adjustment of a number.
+ *
+ * @param {String} type The type of adjustment.
+ * @param {Number} value The number.
+ * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
+ * @returns {Number} The adjusted value.
+ */
+ function decimalAdjust(type, value, exp) {
+ // If the exp is undefined or zero...
+ if (typeof exp === 'undefined' || +exp === 0) {
+ return Math[type](value);
+ }
+ value = +value;
+ exp = +exp;
+ // If the value is not a number or the exp is not an integer...
+ if (isNaN(value) || !(typeof exp === 'number' &amp;&amp; exp % 1 === 0)) {
+ return NaN;
+ }
+ // Shift
+ value = value.toString().split('e');
+ value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
+ // Shift back
+ value = value.toString().split('e');
+ return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
+ }
+
+ // Decimal round
+ if (!Math.round10) {
+ Math.round10 = function(value, exp) {
+ return decimalAdjust('round', value, exp);
+ };
+ }
+ // Decimal floor
+ if (!Math.floor10) {
+ Math.floor10 = function(value, exp) {
+ return decimalAdjust('floor', value, exp);
+ };
+ }
+ // Decimal ceil
+ if (!Math.ceil10) {
+ Math.ceil10 = function(value, exp) {
+ return decimalAdjust('ceil', value, exp);
+ };
+ }
+})();
+
+// Round
+Math.round10(55.55, -1); // 55.6
+Math.round10(55.549, -1); // 55.5
+Math.round10(55, 1); // 60
+Math.round10(54.9, 1); // 50
+Math.round10(-55.55, -1); // -55.5
+Math.round10(-55.551, -1); // -55.6
+Math.round10(-55, 1); // -50
+Math.round10(-55.1, 1); // -60
+Math.round10(1.005, -2); // 1.01 -- compare this with Math.round(1.005*100)/100 above
+// Floor
+Math.floor10(55.59, -1); // 55.5
+Math.floor10(59, 1); // 50
+Math.floor10(-55.51, -1); // -55.6
+Math.floor10(-51, 1); // -60
+// Ceil
+Math.ceil10(55.51, -1); // 55.6
+Math.ceil10(51, 1); // 60
+Math.ceil10(-55.59, -1); // -55.5
+Math.ceil10(-59, 1); // -50
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.8.2.15', 'Math.round')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-math.round', 'Math.round')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Math.abs()")}}</li>
+ <li>{{jsxref("Math.ceil()")}}</li>
+ <li>{{jsxref("Math.floor()")}}</li>
+ <li>{{jsxref("Math.sign()")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Math.trunc()")}} {{experimental_inline}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/nan/index.html b/files/zh-tw/web/javascript/reference/global_objects/nan/index.html
new file mode 100644
index 0000000000..ef027d387f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/nan/index.html
@@ -0,0 +1,85 @@
+---
+title: NaN
+slug: Web/JavaScript/Reference/Global_Objects/NaN
+translation_of: Web/JavaScript/Reference/Global_Objects/NaN
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p>全域屬性 <code><strong>NaN</strong></code> 表示「非數值」(Not-A-Number)的數值。</p>
+
+<p>{{js_property_attributes(0,0,0)}}</p>
+
+<div>{{EmbedInteractiveExample("pages/js/globalprops-nan.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>NaN</code></pre>
+
+<h2 id="描述">描述</h2>
+
+<p><code>NaN</code> 的屬性屬於<em>全域物件</em>。</p>
+
+<p>如同 {{jsxref("Number.NaN")}} 一般,<code>NaN</code> 的初始數值是「非數值」。在當今的瀏覽器中,<code>NaN</code> 屬性不可設定(non-configurable)也不可覆寫(non-writable)。雖然可能有例外,也請不要覆蓋它。</p>
+
+<p>寫程式很少會直接動用 <code>NaN</code>。通常是在 {{jsxref("Math")}} 函式計算失敗(<code>Math.sqrt(-1)</code>)或函式解析數字失敗(<code>parseInt("blabla")</code>)後才會回傳。</p>
+
+<h3 id="偵測是否為_NaN">偵測是否為 <code>NaN</code></h3>
+
+<p><code>NaN</code> 不等於(<code>==</code>、<code>!=</code>、<code>===</code>、<code>!==</code>)任何值,包括 NaN 本身。請使用 {{jsxref("Number.isNaN()")}} 或 {{jsxref("Global_Objects/isNaN", "isNaN()")}} 來確認某個數值是否為 NaN。Or perform a self-comparison: NaN, and only NaN, will compare unequal to itself.</p>
+
+<pre class="brush: js">NaN === NaN; // false
+Number.NaN === NaN; // false
+isNaN(NaN); // true
+isNaN(Number.NaN); // true
+
+function valueIsNaN(v) { return v !== v; }
+valueIsNaN(1); // false
+valueIsNaN(NaN); // true
+valueIsNaN(Number.NaN); // true
+</pre>
+
+<p>但請注意 <code>isNaN()</code> 與 <code>Number.isNaN()</code> 之間是有區別的:前者會在目前數字是 <code>NaN</code> 的時候回傳 <code>true</code>,或在裡面包藏一個號碼後變成 <code>NaN</code>;而後者,只有在數值是 <code>NaN</code> 的時候才會回傳 <code>true</code>。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義。JavaScript 1.3 導入</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.1.1.1', 'NaN')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-value-properties-of-the-global-object-nan', 'NaN')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-value-properties-of-the-global-object-nan', 'NaN')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{Compat("javascript.builtins.NaN")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Number.NaN")}}</li>
+ <li>{{jsxref("Number.isNaN()")}}</li>
+ <li>{{jsxref("isNaN", "isNaN()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/null/index.html b/files/zh-tw/web/javascript/reference/global_objects/null/index.html
new file mode 100644
index 0000000000..0af88facab
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/null/index.html
@@ -0,0 +1,124 @@
+---
+title: 'null'
+slug: Web/JavaScript/Reference/Global_Objects/null
+translation_of: Web/JavaScript/Reference/Global_Objects/null
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p>The value <code>null</code> represents the intentional absence of any object value. It is one of JavaScript's {{Glossary("Primitive", "primitive values")}}.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>null </code></pre>
+
+<h2 id="描述">描述</h2>
+
+<p>The value <code>null</code> is written with a literal, <code>null</code> (it's not an identifer for a property of the global object like {{jsxref("Global_Objects/undefined","undefined")}} can be). In APIs, <code>null</code> is often retrieved in place where an object can be expected but no object is relevant. When checking for null or undefined beware of the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">differences between equality (==) and identity (===) operators</a> (type-conversion is performed with the former).</p>
+
+<pre class="brush: js">// foo does not exist. It is not defined and has never been initialized:
+&gt; foo
+"ReferenceError: foo is not defined"
+
+// foo is known to exist now but it has no type or value:
+&gt; var foo = null; foo
+"null"
+</pre>
+
+<h3 id="Difference_between_null_and_undefined">Difference between <code>null</code> and <code>undefined</code></h3>
+
+<pre class="brush: js">typeof null // object (bug in ECMAScript, should be null)
+typeof undefined // undefined
+null === undefined // false
+null == undefined // true
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-4.3.11', 'null value')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-null-value', 'null value')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-null-value', 'null value')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("undefined")}}</li>
+ <li>{{jsxref("NaN")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/index.html
new file mode 100644
index 0000000000..8a023d1603
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/index.html
@@ -0,0 +1,219 @@
+---
+title: Number
+slug: Web/JavaScript/Reference/Global_Objects/Number
+tags:
+ - JavaScript
+ - NeedsTranslation
+ - Number
+ - Reference
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/Number
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Number</code></strong> JavaScript 物件是允許你操作數值的包覆物件. <code>Number</code> 物件是以 <code>Number()</code> 建構子來建立的。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new Number(value);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>用來建立物件的數值。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p><code>Number</code> 物件主要的用途:</p>
+
+<ul>
+ <li>如果參數沒辦法被轉換成數字,則它會回傳 {{jsxref("NaN")}} 。</li>
+ <li>在不是使用建構式的情境中(即不用 {{jsxref("Operators/new", "new")}} 運算子), <code>Number</code> 可以被用來轉換型別.</li>
+</ul>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Number.EPSILON")}}</dt>
+ <dd>介於1和大於1的最小值之可表示的差。</dd>
+ <dt>{{jsxref("Number.MAX_SAFE_INTEGER")}}</dt>
+ <dd>JavaScript 中 IEEE-754 雙精度範圍間的最大整數 (<code>2<sup>53</sup> - 1</code>) 。</dd>
+ <dt>{{jsxref("Number.MAX_VALUE")}}</dt>
+ <dd>可表示的最大正整數。</dd>
+ <dt>{{jsxref("Number.MIN_SAFE_INTEGER")}}</dt>
+ <dd>JavaScript 中 IEEE-754 雙精度範圍間的最小整數 (<code>-(2<sup>53</sup> - 1)</code>) 。</dd>
+ <dt>{{jsxref("Number.MIN_VALUE")}}</dt>
+ <dd>可表示的最小值,即最靠近0的正整數?(<code><math><semantics><mrow><mn>5.00</mn><mo>×</mo><msup><mn>10</mn><mn>324</mn></msup></mrow><annotation encoding="TeX">5.00\times10^{324}</annotation></semantics></math></code>)。</dd>
+ <dt>{{jsxref("Number.NaN")}}</dt>
+ <dd>特別用來表示<strong>非數值</strong>的物件。</dd>
+ <dt>{{jsxref("Number.NEGATIVE_INFINITY")}}</dt>
+ <dd>特別用來表示<strong>負無窮</strong>的數值。</dd>
+ <dt>{{jsxref("Number.POSITIVE_INFINITY")}}</dt>
+ <dd>特別用來表示<strong>正無窮</strong>的數值。</dd>
+ <dt>{{jsxref("Number.prototype")}}</dt>
+ <dd>允許被添加到 <code>Number</code> 物件的屬性。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Number.isNaN()")}}</dt>
+ <dd>判斷傳入的值是不是 NaN.</dd>
+ <dt>{{jsxref("Number.isFinite()")}}</dt>
+ <dd>判斷傳入的值是不是一個有限的數值。</dd>
+ <dt>{{jsxref("Number.isInteger()")}}</dt>
+ <dd>判斷傳入的值是不是一個整數。</dd>
+ <dt>{{jsxref("Number.isSafeInteger()")}}</dt>
+ <dd>判斷傳入的值是不是在 IEEE-754 雙精度範圍間 (即介於 <code>-(2<sup>53</sup> - 1)</code> 和 <code>2<sup>53</sup> - 1</code>之前)。</dd>
+ <dt><s class="obsoleteElement">{{jsxref("Number.toInteger()")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">被用來評估傳入的值且將其轉換成整數 (或 {{jsxref("Global_Objects/Infinity", "Infinity")}}) 但已被移除。</s></dd>
+ <dt>{{jsxref("Number.parseFloat()")}}</dt>
+ <dd>這個方法和全域物件的 {{jsxref("parseFloat", "parseFloat()")}} 相同。</dd>
+ <dt>{{jsxref("Number.parseInt()")}}</dt>
+ <dd>這個方法和全域物件的 {{jsxref("parseInt", "parseInt()")}} 相同。</dd>
+</dl>
+
+<h2 id="Number_實體"><code>Number</code> 實體</h2>
+
+<p>所有 <code>Number</code> 實體都會繼承其建構式的 {{jsxref("Number.prototype")}}。<code>Number</code> 的原型物件可以被修改並作用在所有 <code>Number</code> 實體。</p>
+
+<h3 id="方法_2">方法</h3>
+
+<div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Number/prototype', '方法')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Number_物件去指派值給數值變數">使用 <code>Number</code> 物件去指派值給數值變數</h3>
+
+<p>下列的範例使用 <code>Number</code> 物件的屬性去指派值給數個數值變數:</p>
+
+<pre class="brush: js">var biggestNum = Number.MAX_VALUE;
+var smallestNum = Number.MIN_VALUE;
+var infiniteNum = Number.POSITIVE_INFINITY;
+var negInfiniteNum = Number.NEGATIVE_INFINITY;
+var notANum = Number.NaN;
+</pre>
+
+<h3 id="Number_的整數範圍"><code>Number</code> 的整數範圍</h3>
+
+<p>下面的範例展示了最小和最大的整數,其可以被表示成 <code>Number</code> 物件(細節請參考 ECMAScript standard, chapter <em>8.5 The Number Type</em>):</p>
+
+<pre class="brush: js">var biggestInt = 9007199254740992;
+var smallestInt = -9007199254740992;
+</pre>
+
+<p>當在解析已經被序列化的 JSON 的資料時,填入這個範圍之外的整數並且 JSON 剖析器強制將其轉成 <code>Number</code> 型別造成損壞是可預期的。將範圍之外的正數換成以 {{jsxref("String")}} 表示反倒是一個可行的替代方案。</p>
+
+<h3 id="使用_Number_轉換_Date_物件為_Unix_時間戳記">使用 <code>Number</code> 轉換 <code>Date</code> 物件為 Unix 時間戳記</h3>
+
+<p>下面的範例將 <code>Number</code> 視為函式,並且使用它將 {{jsxref("Date")}} 轉換成時間戳記:</p>
+
+<pre class="brush: js">var d = new Date('December 17, 1995 03:24:00');
+console.log(Number(d)); // 819199440000
+
+</pre>
+
+<h3 id="轉換數值字串成數值">轉換數值字串成數值</h3>
+
+<pre class="brush: js">Number("123") // 123
+Number("12.3") // 12.3
+Number("") // 0
+Number("0x11") // 17
+Number("0b11") // 3
+Number("0o11") // 9
+Number("foo") // NaN
+Number("100a") // NaN
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註記</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.7', 'Number')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number-objects', 'Number')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>New methods and properties added: {{jsxref("Number.EPSILON", "EPSILON")}}, {{jsxref("Number.isFinite", "isFinite")}}, {{jsxref("Number.isInteger", "isInteger")}}, {{jsxref("Number.isNaN", "isNaN")}}, {{jsxref("Number.parseFloat", "parseFloat")}}, {{jsxref("Number.parseInt", "parseInt")}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-number-objects', 'Number')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容">瀏覽器相容</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("NaN")}}</li>
+ <li>The {{jsxref("Math")}} global object</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/isfinite/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/isfinite/index.html
new file mode 100644
index 0000000000..a15d29c7c0
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/isfinite/index.html
@@ -0,0 +1,93 @@
+---
+title: Number.isFinite()
+slug: Web/JavaScript/Reference/Global_Objects/Number/isFinite
+tags:
+ - JavaScript
+ - Method
+ - Number
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/isFinite
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Number.isFinite()</code></strong> 方法會判斷傳入的值是否為有限數(finite number)。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/number-isfinite.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">Number.isFinite(v<var>alue</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>The value to be tested for finiteness.</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A {{jsxref("Boolean")}} indicating whether or not the given value is a finite number.</p>
+
+<h2 id="說明">說明</h2>
+
+<p>In comparison to the global {{jsxref("isFinite", "isFinite()")}} function, this method doesn't forcibly convert the parameter to a number. This means only values of the type number, that are also finite, return <code>true</code>.</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">Number.isFinite(Infinity); // false
+Number.isFinite(NaN); // false
+Number.isFinite(-Infinity); // false
+
+Number.isFinite(0); // true
+Number.isFinite(2e64); // true
+
+Number.isFinite('0'); // false, would've been true with
+ // global isFinite('0')
+Number.isFinite(null); // false, would've been true with
+ // global isFinite(null)
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<pre class="brush: js">Number.isFinite = Number.isFinite || function(value) {
+    return typeof value === 'number' &amp;&amp; isFinite(value);
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number.isfinite', 'Number.isInteger')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-number.isfinite', 'Number.isInteger')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Number.isFinite")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>The {{jsxref("Number")}} object it belongs to.</li>
+ <li>The global function {{jsxref("isFinite")}}.</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/isnan/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/isnan/index.html
new file mode 100644
index 0000000000..9209e40779
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/isnan/index.html
@@ -0,0 +1,99 @@
+---
+title: Number.isNaN()
+slug: Web/JavaScript/Reference/Global_Objects/Number/isNaN
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/isNaN
+---
+<div>{{JSRef}}</div>
+
+<p>The <strong><code>Number.isNaN()</code></strong> method determines whether the passed value is {{jsxref("NaN")}} and its type is {{jsxref("Number")}}. It is a more robust version of the original, global {{jsxref("isNaN", "isNaN()")}}.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/number-isnan.html", "taller")}}</div>
+
+
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code>Number.isNaN(<var>value</var>)</code></pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>The value to be tested for {{jsxref("NaN")}}.</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p><strong>true</strong> if the given value is {{jsxref("NaN")}} and its type is {{jsxref("Number")}}; otherwise, <strong>false</strong>.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>Due to both equality operators, {{jsxref("Operators/Comparison_Operators", "==", "#Equality")}} and {{jsxref("Operators/Comparison_Operators", "===", "#Identity")}}, evaluating to <code>false</code> when checking if {{jsxref("NaN")}} <em>is</em> {{jsxref("NaN")}}, the function <code>Number.isNaN()</code> has become necessary. This situation is unlike all other possible value comparisons in JavaScript.</p>
+
+<p>In comparison to the global {{jsxref("isNaN", "isNaN()")}} function, <code>Number.isNaN()</code> doesn't suffer the problem of forcefully converting the parameter to a number. This means it is now safe to pass values that would normally convert to {{jsxref("NaN")}}, but aren't actually the same value as {{jsxref("NaN")}}. This also means that only values of the type number, that are also {{jsxref("NaN")}}, return <code>true</code>.</p>
+
+<h2 id="Examples">Examples</h2>
+
+<pre class="brush: js">Number.isNaN(NaN); // true
+Number.isNaN(Number.NaN); // true
+Number.isNaN(0 / 0); // true
+
+// e.g. these would have been true with global isNaN()
+Number.isNaN('NaN'); // false
+Number.isNaN(undefined); // false
+Number.isNaN({}); // false
+Number.isNaN('blabla'); // false
+
+// These all return false
+Number.isNaN(true);
+Number.isNaN(null);
+Number.isNaN(37);
+Number.isNaN('37');
+Number.isNaN('37.37');
+Number.isNaN('');
+Number.isNaN(' ');
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>The following works because NaN is the only value in javascript which is not equal to itself.</p>
+
+<pre class="brush: js">Number.isNaN = Number.isNaN || function(value) {
+  return value !== value;
+}
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-number.isnan', 'Number.isnan')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-number.isnan', 'Number.isnan')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Number.isNaN")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Number")}}</li>
+ <li>{{jsxref("isNaN", "isNaN()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html
new file mode 100644
index 0000000000..2a41977a2d
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/prototype/index.html
@@ -0,0 +1,84 @@
+---
+title: Number.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Number/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Number
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Number.prototype</code></strong> 屬性用來表示 {{jsxref("Number")}} 建構式的原型。</p>
+
+<div>{{js_property_attributes(0, 0, 0)}}</div>
+
+<h2 id="說明">說明</h2>
+
+<p>所有 {{jsxref("Number")}} 實體都繼承自 <code>Number.prototype</code> 。{{jsxref("Number")}} 建構式的原型物件可以被修改並作用在所有 {{jsxref("Number")}} 實體。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Number.prototype.constructor</code></dt>
+ <dd>回傳建立這個物件實體的建構式。預設為 {{jsxref("Number")}} 物件。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Number.prototype.toExponential()")}}</dt>
+ <dd>回傳以「科學記數法」表示的數值字串。</dd>
+ <dt>{{jsxref("Number.prototype.toFixed()")}}</dt>
+ <dd>回傳以定點表示的數值字串。</dd>
+ <dt>{{jsxref("Number.prototype.toLocaleString()")}}</dt>
+ <dd>回傳以當地語言為主的數值字串。這覆寫 {{jsxref("Object.prototype.toLocaleString()")}} 的方法。</dd>
+ <dt>{{jsxref("Number.prototype.toPrecision()")}}</dt>
+ <dd>回傳以定點或科學記數表示的數值字串。</dd>
+ <dt>{{jsxref("Number.prototype.toSource()")}} {{non-standard_inline}}</dt>
+ <dd>Returns an object literal representing the specified {{jsxref("Number")}} object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.</dd>
+ <dt>{{jsxref("Number.prototype.toString()")}}</dt>
+ <dd>回傳以特定基數表示的數值字串。這覆寫 {{jsxref("Object.prototype.toString()")}} 的方法 。</dd>
+ <dt>{{jsxref("Number.prototype.valueOf()")}}</dt>
+ <dd>回傳這個物件的原始型別,即原始數值。這覆寫 {{jsxref("Object.prototype.valueOf()")}} 。</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註記</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.1.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.7.4', 'Number')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-properties-of-the-number-prototype-object', 'Number')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-properties-of-the-number-prototype-object', 'Number')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Number.prototype")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Number")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html
new file mode 100644
index 0000000000..622314ecfb
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/toexponential/index.html
@@ -0,0 +1,164 @@
+---
+title: Number.prototype.toExponential()
+slug: Web/JavaScript/Reference/Global_Objects/Number/toExponential
+tags:
+ - 數字
+ - 科學技數法
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/toExponential
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>toExponential()</code></strong> method 用來將數字轉成「科學記數法」格式。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><var>numObj</var>.toExponential([<var>fractionDigits</var>])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th>參數</th>
+ <th>可選</th>
+ <th>默認值</th>
+ <th>類型</th>
+ <th>說明</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>fractionDigits</code></td>
+ <td>●</td>
+ <td><font face="Consolas, Liberation Mono, Courier, monospace">默認盡可能將數字完整顯示</font></td>
+ <td><code>{{jsxref("Number")}}(正整數)</code></td>
+ <td>小數點後的位數。需為 0 至 20 之間。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h3 id="回傳直">回傳直</h3>
+
+<p>一 string,將數字以「科學計數法」格式表示出來</p>
+
+<h3 id="Exceptions">Exceptions</h3>
+
+<dl>
+ <dt>{{jsxref("RangeError")}}</dt>
+ <dd><code>若 fractionDigits</code> 超出範圍(可接受的範圍是 0 ~ 20 之間的正整數)觸發 {{jsxref("RangeError")}}。</dd>
+ <dt>{{jsxref("TypeError")}}</dt>
+ <dd>若參數 <code>fractionDigits</code> 不是 {{jsxref("Number")}},則觸發{{jsxref("TypeError")}}。</dd>
+</dl>
+
+<h2 id="Description">Description</h2>
+
+<p>If the <code>fractionDigits</code> argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely.</p>
+
+<p>If you use the <code>toExponential()</code> method for a numeric literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to prevent the dot from being interpreted as a decimal point.</p>
+
+<p>If a number has more digits than requested by the <code>fractionDigits</code> parameter, the number is rounded to the nearest number represented by <code>fractionDigits</code> digits. See the discussion of rounding in the description of the {{jsxref("Number.prototype.toFixed", "toFixed()")}} method, which also applies to <code>toExponential()</code>.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_toExponential">Using <code>toExponential</code></h3>
+
+<pre class="brush: js">var numObj = 77.1234;
+
+console.log(numObj.toExponential()); // logs 7.71234e+1
+console.log(numObj.toExponential(4)); // logs 7.7123e+1
+console.log(numObj.toExponential(2)); // logs 7.71e+1
+console.log(77.1234.toExponential()); // logs 7.71234e+1
+console.log(77 .toExponential()); // logs 7.7e+1
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.7.4.6', 'Number.prototype.toExponential')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器支援度">瀏覽器支援度</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="延伸閱讀">延伸閱讀</h2>
+
+<ul>
+ <li>{{jsxref("Number.prototype.toFixed()")}}</li>
+ <li>{{jsxref("Number.prototype.toPrecision()")}}</li>
+ <li>{{jsxref("Number.prototype.toString()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/number/tofixed/index.html b/files/zh-tw/web/javascript/reference/global_objects/number/tofixed/index.html
new file mode 100644
index 0000000000..7a5afb608f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/number/tofixed/index.html
@@ -0,0 +1,108 @@
+---
+title: Number.prototype.toFixed()
+slug: Web/JavaScript/Reference/Global_Objects/Number/toFixed
+tags:
+ - JavaScript
+ - Method
+ - Number
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Number/toFixed
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>toFixed()</code></strong> 方法會使用定點小數表示法(fixed-point notation)來格式化數字。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/number-tofixed.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate"><code><var>numObj</var>.toFixed([<var>digits</var>])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>digits 小數位</code></dt>
+ <dd>選擇性輸入。顯示數值至多少個小數點,範圍由0到20之間,執行時或可支援非常大範圍的數值。如果無輸入會默認做0。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個代表以定點小數表示法(fixed-point notation)格式化數字後的字串。</p>
+
+<h3 id="例外">例外</h3>
+
+<dl>
+ <dt>{{jsxref("RangeError")}}</dt>
+ <dd>If <code>digits</code> is too small or too large. Values between 0 and 100, inclusive, will not cause a {{jsxref("RangeError")}}. Implementations are allowed to support larger and smaller values as chosen.</dd>
+ <dt>{{jsxref("TypeError")}}</dt>
+ <dd>If this method is invoked on an object that is not a {{jsxref( "Number")}}.</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p><strong><code>toFixed()</code></strong> returns a string representation of <code>numObj</code> that does not use exponential notation and has exactly <code>digits</code> digits after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length. If <code>numObj</code> is greater than <code>1e+21</code>, this method simply calls {{jsxref("Number.prototype.toString()")}} and returns a string in exponential notation.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_toFixed">Using <code>toFixed</code></h3>
+
+<pre class="brush: js notranslate">var numObj = 12345.6789;
+
+numObj.toFixed(); // Returns '12346': note rounding, no fractional part
+numObj.toFixed(1); // Returns '12345.7': note rounding
+numObj.toFixed(6); // Returns '12345.678900': note added zeros
+(1.23e+20).toFixed(2); // Returns '123000000000000000000.00'
+(1.23e-10).toFixed(2); // Returns '0.00'
+2.34.toFixed(1); // Returns '2.3'
+2.35.toFixed(1); // Returns '2.4'. Note that it rounds up in this case.
+-2.34.toFixed(1); // Returns -2.3 (due to operator precedence, negative number literals don't return a string...)
+(-2.34).toFixed(1); // Returns '-2.3' (...unless you use parentheses)
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.7.4.5', 'Number.prototype.toFixed')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-number.prototype.tofixed', 'Number.prototype.toFixed')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-number.prototype.tofixed', 'Number.prototype.toFixed')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Number.toFixed")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Number.prototype.toExponential()")}}</li>
+ <li>{{jsxref("Number.prototype.toPrecision()")}}</li>
+ <li>{{jsxref("Number.prototype.toString()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html
new file mode 100644
index 0000000000..f4dfca5af7
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/assign/index.html
@@ -0,0 +1,249 @@
+---
+title: Object.assign()
+slug: Web/JavaScript/Reference/Global_Objects/Object/assign
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/assign
+---
+<div>{{JSRef}}</div>
+
+<div><strong><code>Object.assign()</code></strong>被用來複製一個或多個物件自身所有可數的屬性到另一個目標物件。回傳的值為該目標物件。</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">Object.assign(<var>target</var>, ...<var>sources</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>target</code></dt>
+ <dd>目標物件</dd>
+ <dt><code>sources</code></dt>
+ <dd>來源物件</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>     合併目標物件及(多個)來源物件所得到的最終物件。</p>
+
+<h2 id="說明">說明</h2>
+
+<p>如果在目標物件裡的屬性名稱(key)和來源物件的屬性名稱相同,將會被覆寫。若來源物件之間又有相同的屬性名稱,則後者會將前者覆寫。</p>
+
+<p><code>Object.assign()</code>只會從來源物件將自身可列舉的屬性複製到目標物件。此函式方法(method) 使用來源物件的<code>[[Get]]</code>事件和目標物件的<code>[[Set]]</code>事件,使它將會執行getters和setters。因此,這邊的指派(<em>assigns</em>)屬性不只是複製或定義新屬性。若在合併包含getters的來源物件時,這個事件可能就不適合用來合併屬性。至於複製屬性的定義(包含其可列舉性)到各屬性,反倒是會用到 {{jsxref("Object.getOwnPropertyDescriptor()")}} 和 {{jsxref("Object.defineProperty()")}} 。</p>
+
+<p>{{jsxref("String")}} 和 {{jsxref("Symbol")}} 類型的屬性都會被複製。</p>
+
+<p>若發生錯誤,例如: 當一個屬性不可被寫入時,將會引發 {{jsxref("TypeError")}} 的錯誤,且目標物件剩餘的屬性將不會改變。</p>
+
+<p>注意: <code>Object.assign()</code> 不會在來源物件屬性的值為{{jsxref("null")}} 或 {{jsxref("undefined")}} 的時候拋出錯誤。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="複製物件">複製物件</h3>
+
+<pre class="brush: js notranslate">var obj = { a: 1 };
+var copy = Object.assign({}, obj);
+console.log(copy); // { a: 1 }
+</pre>
+
+<h3 id="Deep_Clone" name="Deep_Clone">警告:非深層複製</h3>
+
+<p>深層複製(deep clone)需要使用其他的替代方案,因為 <code>Object.assign()</code> 僅複製屬性值。若來源物件的值參照到一個子物件,它只會複製該子物件的參照。</p>
+
+<pre class="brush: js notranslate">function test() {
+ let a = { b: {c:4} , d: { e: {f:1}} }
+ let g = Object.assign({},a) // 淺層
+ let h = JSON.parse(JSON.stringify(a)); // 深層
+ console.log(g.d) // { e: { f: 1 } }
+ g.d.e = 32
+ console.log('g.d.e set to 32.') // g.d.e set to 32.
+ console.log(g) // { b: { c: 4 }, d: { e: 32 } }
+ console.log(a) // { b: { c: 4 }, d: { e: 32 } }
+ console.log(h) // { b: { c: 4 }, d: { e: { f: 1 } } }
+ h.d.e = 54
+ console.log('h.d.e set to 54.') // h.d.e set to 54.
+ console.log(g) // { b: { c: 4 }, d: { e: 32 } }
+ console.log(a) // { b: { c: 4 }, d: { e: 32 } }
+ console.log(h) // { b: { c: 4 }, d: { e: 54 } }
+}
+test();
+</pre>
+
+<h3 id="合併物件">合併物件</h3>
+
+<pre class="brush: js notranslate">var o1 = { a: 1 };
+var o2 = { b: 2 };
+var o3 = { c: 3 };
+
+var obj = Object.assign(o1, o2, o3);
+console.log(obj); // { a: 1, b: 2, c: 3 }
+console.log(o1); // { a: 1, b: 2, c: 3 }, 目標物件本身也被改變。</pre>
+
+<h3 id="有相同屬性時合併物件">有相同屬性時合併物件</h3>
+
+<pre class="brush: js notranslate">var o1 = { a: 1, b: 1, c: 1 };
+var o2 = { b: 2, c: 2 };
+var o3 = { c: 3 };
+
+var obj = Object.assign({}, o1, o2, o3);
+console.log(obj); // { a: 1, b: 2, c: 3 },屬性c為o3.c的值,最後一個出現的屬性c。</pre>
+
+<p>所有的屬性會被後方相同屬性名稱的值覆寫。</p>
+
+<h3 id="複製_Symbol_型別的屬性">複製 Symbol 型別的屬性</h3>
+
+<pre class="brush: js notranslate">var o1 = { a: 1 };
+var o2 = { [Symbol('foo')]: 2 };
+
+var obj = Object.assign({}, o1, o2);
+console.log(obj); // { a : 1, [Symbol("foo")]: 2 } (cf. bug 1207182 on Firefox)
+Object.getOwnPropertySymbols(obj); // [Symbol(foo)]非不在
+</pre>
+
+<h3 id="在屬性鏈中的不可列舉屬性不會被複製">在屬性鏈中的不可列舉屬性不會被複製</h3>
+
+<pre class="brush: js notranslate">var obj = Object.create({ foo: 1 }, { // foo 是 obj 的屬性鏈。
+ bar: {
+ value: 2 // bar 是不可列舉的屬性,因為enumerable預設為false。
+ },
+ baz: {
+ value: 3,
+ enumerable: true // baz 是自身可列舉的屬性。
+ }
+});
+
+var copy = Object.assign({}, obj);
+console.log(copy); // { baz: 3 }
+</pre>
+
+<h3 id="原始型別會被包成物件">原始型別會被包成物件</h3>
+
+<pre class="brush: js notranslate">var v1 = 'abc';
+var v2 = true;
+var v3 = 10;
+var v4 = Symbol('foo');
+
+var obj = Object.assign({}, v1, null, v2, undefined, v3, v4);
+// 原始型別會被打包,null和undefined則會被忽略。
+// 注意: 只有打包成物件的字串是可列舉的,即可被複製的。
+console.log(obj); // { "0": "a", "1": "b", "2": "c" }
+</pre>
+
+<h3 id="任何異常將會中斷正進行的複製程序">任何異常將會中斷正進行的複製程序</h3>
+
+<pre class="brush: js notranslate">var target = Object.defineProperty({}, 'foo', {
+ value: 1,
+ writable: false
+}); // target.foo 是 read-only (唯讀)屬性
+
+Object.assign(target, { bar: 2 }, { foo2: 3, foo: 3, foo3: 3 }, { baz: 4 });
+// TypeError: "foo" 是 read-only
+// 在指派值給 target.foo 時,異常(Exception)會被拋出。
+
+console.log(target.bar); // 2, 第一個來源物件複製成功。
+console.log(target.foo2); // 3, 第二個來源物件的第一個屬性複製成功。
+console.log(target.foo); // 1, 異常在這裡拋出。
+console.log(target.foo3); // undefined, 複製程式已中斷,複製失敗。
+console.log(target.baz); // undefined, 第三個來源物件也不會被複製。
+</pre>
+
+<h3 id="複製的存取程序">複製的存取程序</h3>
+
+<pre class="brush: js notranslate">var obj = {
+ foo: 1,
+ get bar() {
+ return 2;
+ }
+};
+
+var copy = Object.assign({}, obj);
+console.log(copy);
+// { foo: 1, bar: 2 }, copy.bar的值,是obj.bar的getter回傳的值。
+
+// 這個函式用來複製完整的描述內容。
+function completeAssign(target, ...sources) {
+ sources.forEach(source =&gt; {
+  let descriptors = Object.keys(source).reduce((descriptors, key) =&gt; {
+  descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
+  return descriptors;
+  }, {});
+  // Object.assign 預設會複製可列舉的Symbols。
+  Object.getOwnPropertySymbols(source).forEach(sym =&gt; {
+  let descriptor = Object.getOwnPropertyDescriptor(source, sym);
+  if (descriptor.enumerable) {
+  descriptors[sym] = descriptor;
+  }
+  });
+ Object.defineProperties(target, descriptors);
+ });
+ return target;
+}
+
+var copy = completeAssign({}, obj);
+console.log(copy);
+// { foo:1, get bar() { return 2 } }
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>{{Glossary("Polyfill","polyfill")}} 不支援Symbol屬性,因為ES5沒有Symbol型別。</p>
+
+<pre class="brush: js notranslate">if (typeof Object.assign != 'function') {
+  Object.assign = function (target, varArgs) { // .length of function is 2
+    'use strict';
+    if (target == null) { // TypeError if undefined or null
+      throw new TypeError('Cannot convert undefined or null to object');
+    }
+
+    var to = Object(target);
+
+    for (var index = 1; index &lt; arguments.length; index++) {
+      var nextSource = arguments[index];
+
+      if (nextSource != null) { // Skip over if undefined or null
+        for (var nextKey in nextSource) {
+ // Avoid bugs when hasOwnProperty is shadowed
+          if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
+            to[nextKey] = nextSource[nextKey];
+          }
+        }
+      }
+    }
+    return to;
+  };
+}
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.assign', 'Object.assign')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.assign', 'Object.assign')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{Compat("javascript.builtins.Object.assign")}}</div>
+
+<div id="compat-desktop"></div>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{jsxref("Object.defineProperties()")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html
new file mode 100644
index 0000000000..f158d36977
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/create/index.html
@@ -0,0 +1,258 @@
+---
+title: Object.create()
+slug: Web/JavaScript/Reference/Global_Objects/Object/create
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/create
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.create()</strong></code> 指定其原型物件與屬性,創建一個新物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">Object.create(<var>proto</var>[, <var>propertiesObject</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>proto</code></dt>
+ <dd>指定新物件的原型 (prototype) 物件。</dd>
+ <dt><code>propertiesObject</code></dt>
+ <dd>選用,為一物件。如有指定且非 {{jsxref("undefined")}},則此參數物件中可列舉出的屬性 (即參數物件自身定義的屬性,並非指原型鏈上的 <code>enumerable</code> 特性 ) 對應其屬性名稱,根據其屬性敘述元 (property descriptors) 加進新創建的物件。這些屬性對應到 {{jsxref("Object.defineProperties()")}} 的第二個參數。</dd>
+</dl>
+
+<h3 id="回傳">回傳</h3>
+
+<p>具有指定原型物件與屬性的新物件。</p>
+
+<h3 id="例外">例外</h3>
+
+<p> 如果 <code>proto</code> 參數不是 {{jsxref("null")}} 或一個物件,將會拋出 {{jsxref("TypeError")}} 例外。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Object.create()_實現類別繼承">使用 <code>Object.create() </code>實現類別繼承</h3>
+
+<p>下方是如何使用 <code>Object.create()</code> 去實現類別繼承的示範,此為 JavaScript 支援的單一繼承.。</p>
+
+<pre class="brush: js">// Shape - 父類別
+function Shape() {
+ this.x = 0;
+ this.y = 0;
+}
+
+// 父類別的方法
+Shape.prototype.move = function(x, y) {
+ this.x += x;
+ this.y += y;
+ console.info('Shape moved.');
+};
+
+// Rectangle - 子類別
+function Rectangle() {
+ Shape.call(this); // call super constructor.
+}
+
+// 子類別擴展(extends)父類別
+Rectangle.prototype = Object.create(Shape.prototype);
+Rectangle.prototype.constructor = Rectangle;
+
+var rect = new Rectangle();
+
+console.log('Is rect an instance of Rectangle?', rect instanceof Rectangle);// true
+console.log('Is rect an instance of Shape?', rect instanceof Shape);// true
+rect.move(1, 1); // Outputs, 'Shape moved.'
+</pre>
+
+<p>也可像 mixin 繼承多個物件。</p>
+
+<pre class="brush: js">function MyClass() {
+ SuperClass.call(this);
+ OtherSuperClass.call(this);
+}
+
+// 繼承一個父類別
+MyClass.prototype = Object.create(SuperClass.prototype);
+// mixin另一個父類別
+Object.assign(MyClass.prototype, OtherSuperClass.prototype);
+// 重新指定建構式
+MyClass.prototype.constructor = MyClass;
+
+MyClass.prototype.myMethod = function() {
+ // do a thing
+};
+</pre>
+
+<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign">Object.assign</a> 複製 OtherSuperClass 原型上的所有屬性到 MyClass 的原型上,使所有 MyClass 的實例都能使用。Object.assign 為 ES2015 標準且<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill">有 polyfill</a>。如需支援較舊的瀏覽器,可使用第三方套件實現如 <a href="https://api.jquery.com/jQuery.extend/">jQuery.extend()</a> 或 <a href="https://lodash.com/docs/#assign">_.assign()</a> 。</p>
+
+<h3 id="propertiesObject_參數的使用"><code>propertiesObject</code> 參數的使用</h3>
+
+<pre class="brush: js">var o;
+
+// 建立以null為原型的物件
+o = Object.create(null);
+
+
+o = {};
+// 等同於:
+o = Object.create(Object.prototype);
+
+
+// Example where we create an object with a couple of sample properties.
+// (Note that the second parameter maps keys to *property descriptors*.)
+o = Object.create(Object.prototype, {
+ // foo 為數值屬性
+ foo: { writable: true, configurable: true, value: 'hello' },
+ // bar 為 getter-and-setter 訪問屬性
+ bar: {
+ configurable: false,
+ get: function() { return 10; },
+ set: function(value) { console.log('Setting `o.bar` to', value); }
+/* with ES5 Accessors our code can look like this
+ get function() { return 10; },
+ set function(value) { console.log('setting `o.bar` to', value); } */
+ }
+});
+
+
+function Constructor() {}
+o = new Constructor();
+// 等同於:
+o = Object.create(Constructor.prototype);
+// Of course, if there is actual initialization code in the
+// Constructor function, the Object.create() cannot reflect it
+
+
+// 創建一個新物件,指定原型是全新的空物件,並加入值為 42 的屬性'p'
+o = Object.create({}, { p: { value: 42 } });
+
+// 屬性敘述元 writable, enumerable , configurable 未定義,預設皆為 false
+o.p = 24;
+o.p;
+// 42
+
+o.q = 12;
+for (var prop in o) {
+ console.log(prop);
+}
+// 'q'
+
+delete o.p;
+// false
+
+// to specify an ES3 property
+o2 = Object.create({}, {
+ p: {
+ value: 42,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ }
+});
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>此 polyfill 涵蓋了主要的使用情境:指定一個原型創建一個新的物件,第二個參數為選用。</p>
+
+<p>要注意的是在 ES5 的<code>Object.create</code>中, <code>[[Prototype]]</code> 可以為 <code>null</code>,但在ECMAScript 5 以前的版本,polyfill 會因為繼承限制( limitation inherent )而不支援此情形。</p>
+
+<pre><code>if (typeof Object.create !== "function") {
+ Object.create = function (proto, propertiesObject) {
+ if (!(proto === null || typeof proto === "object" || typeof proto === "function")) {
+ throw TypeError('Argument must be an object, or null');
+ }
+ var temp = new Object();
+ temp.__proto__ = proto;
+ if(typeof propertiesObject === "object")
+ Object.defineProperties(temp, propertiesObject);
+ return temp;
+ };
+}</code></pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.5', 'Object.create')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.create', 'Object.create')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.create', 'Object.create')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatGeckoDesktop("2")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("11.60")}}</td>
+ <td>{{CompatSafari("5")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("2")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatOperaMobile("11.5")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{jsxref("Object.defineProperty()")}}</li>
+ <li>{{jsxref("Object.defineProperties()")}}</li>
+ <li>{{jsxref("Object.prototype.isPrototypeOf()")}}</li>
+ <li>John Resig's post on <a href="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf()</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html
new file mode 100644
index 0000000000..fc87ca0317
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperties/index.html
@@ -0,0 +1,224 @@
+---
+title: Object.defineProperties()
+slug: Web/JavaScript/Reference/Global_Objects/Object/defineProperties
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.defineProperties()</strong></code> 函式可定義新的或是修改已存在的物件屬性,並回傳修改後的物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Object.defineProperties(<var>obj</var>, <var>props</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>The object on which to define or modify properties.</dd>
+ <dt><code>props</code></dt>
+ <dd>An object whose own enumerable properties constitute descriptors for the properties to be defined or modified. Property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors (see {{jsxref("Object.defineProperty()")}} for more details). Descriptors have the following keys:</dd>
+ <dd>
+ <dl>
+ <dt><code>configurable</code></dt>
+ <dd><code>true</code> if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.<br>
+ <strong>預設為 <code>false</code>.</strong></dd>
+ <dt><code>enumerable</code></dt>
+ <dd><code>若該屬性設為 true,則該屬性可被物件所列舉。</code><br>
+ <strong>預設為 <code>false</code>.</strong></dd>
+ </dl>
+
+ <dl>
+ <dt><code>value</code></dt>
+ <dd>The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).<br>
+ <strong>預設為 {{jsxref("undefined")}}.</strong></dd>
+ <dt><code>writable</code></dt>
+ <dd><code>若該屬性為 true</code>,則該屬性可透過{{jsxref("Operators/Assignment_Operators", "賦予運算子", "", 1)}}所改變<br>
+ <strong>預設為 <code>false</code>.</strong></dd>
+ </dl>
+
+ <dl>
+ <dt><code>get</code></dt>
+ <dd>A function which serves as a getter for the property, or {{jsxref("undefined")}} if there is no getter. The function return will be used as the value of property.<br>
+ <strong>預設為 {{jsxref("undefined")}}.</strong></dd>
+ <dt><code>set</code></dt>
+ <dd>A function which serves as a setter for the property, or {{jsxref("undefined")}} if there is no setter. The function will receive as only argument the new value being assigned to the property.<br>
+ <strong>預設為 {{jsxref("undefined")}}.</strong></dd>
+ </dl>
+ </dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>The object that was passed to the function.</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Object.defineProperties</code>, in essence, defines all properties corresponding to the enumerable own properties of <code>props</code> on the object <code>obj</code> object.</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var obj = {};
+Object.defineProperties(obj, {
+ 'property1': {
+ value: true,
+ writable: true
+ },
+ 'property2': {
+ value: 'Hello',
+ writable: false
+ }
+ // etc. etc.
+});
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>Assuming a pristine execution environment with all names and properties referring to their initial values, <code>Object.defineProperties</code> is almost completely equivalent (note the comment in <code>isCallable</code>) to the following reimplementation in JavaScript:</p>
+
+<pre class="brush: js;highlight:[8]">function defineProperties(obj, properties) {
+ function convertToDescriptor(desc) {
+ function hasProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ function isCallable(v) {
+ // NB: modify as necessary if other values than functions are callable.
+ return typeof v === 'function';
+ }
+
+ if (typeof desc !== 'object' || desc === null)
+ throw new TypeError('bad desc');
+
+ var d = {};
+
+ if (hasProperty(desc, 'enumerable'))
+ d.enumerable = !!desc.enumerable;
+ if (hasProperty(desc, 'configurable'))
+ d.configurable = !!desc.configurable;
+ if (hasProperty(desc, 'value'))
+ d.value = desc.value;
+ if (hasProperty(desc, 'writable'))
+ d.writable = !!desc.writable;
+ if (hasProperty(desc, 'get')) {
+ var g = desc.get;
+
+ if (!isCallable(g) &amp;&amp; typeof g !== 'undefined')
+ throw new TypeError('bad get');
+ d.get = g;
+ }
+ if (hasProperty(desc, 'set')) {
+ var s = desc.set;
+ if (!isCallable(s) &amp;&amp; typeof s !== 'undefined')
+ throw new TypeError('bad set');
+ d.set = s;
+ }
+
+ if (('get' in d || 'set' in d) &amp;&amp; ('value' in d || 'writable' in d))
+ throw new TypeError('identity-confused descriptor');
+
+ return d;
+ }
+
+ if (typeof obj !== 'object' || obj === null)
+ throw new TypeError('bad obj');
+
+ properties = Object(properties);
+
+ var keys = Object.keys(properties);
+ var descs = [];
+
+ for (var i = 0; i &lt; keys.length; i++)
+ descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
+
+ for (var i = 0; i &lt; descs.length; i++)
+ Object.defineProperty(obj, descs[i][0], descs[i][1]);
+
+ return obj;
+}
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">註記</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.7', 'Object.defineProperties')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.defineproperties', 'Object.defineProperties')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.defineproperties', 'Object.defineProperties')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Firefox (Gecko)</th>
+ <th>Chrome</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatGeckoDesktop("2")}}</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("11.60")}}</td>
+ <td>{{CompatSafari("5")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Android</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatGeckoMobile("2")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOperaMobile("11.5")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{jsxref("Object.defineProperty()")}}</li>
+ <li>{{jsxref("Object.keys()")}}</li>
+ <li><a href="/en-US/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html
new file mode 100644
index 0000000000..cf83590181
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/defineproperty/index.html
@@ -0,0 +1,380 @@
+---
+title: Object.defineProperty()
+slug: Web/JavaScript/Reference/Global_Objects/Object/defineProperty
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperty
+---
+<div>{{JSRef}}</div>
+
+<p>靜態方法 <code><strong>Object.defineProperty()</strong></code> 會直接對一個物件定義、或是修改現有的屬性。執行後會回傳定義完的物件。</p>
+
+<div class="note">
+<p><strong>注:</strong>這個方法會直接針對 {{jsxref("Object")}} 呼叫建構子(constructor),而不是 <code>Object</code> 型別的實例。</p>
+</div>
+
+<div>{{EmbedInteractiveExample("pages/js/object-defineproperty.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Object.defineProperty(<var>obj</var>, <var>prop</var>, <var>descriptor</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>要定義屬性的物件。</dd>
+ <dt><code>prop</code></dt>
+ <dd>要被定義或修改的屬性名字。</dd>
+ <dt><code>descriptor</code></dt>
+ <dd>要定義或修改物件敘述內容。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>被定義完或修改完屬性的物件。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>這個函式可以用來增加或修改物件中的屬性定義。在物件建立屬性後,這些屬性同時有被設定預設的設定,才能讓這些屬性被列舉、改變和刪除。而這個函式可以用來改變這些預設的設定。根據預設,被加到物件且使用<code>Object.defineProperty()</code>的值都是{{glossary("Immutable")}}。</p>
+
+<p>物件內的屬性描述器(Property descriptor)主要有兩種:資料描述器(data descriptor)與訪問描述器(accessor descriptor)。<dfn>資料描述器</dfn>(data descriptor)是可以選擇能否覆寫的屬性。<dfn>訪問描述器</dfn>(accessor descriptor) is a property described by a getter-setter pair of functions. A descriptor must be one of these two flavors; it cannot be both.</p>
+
+<p>data 和 accessor descriptors 皆為物件,兩者共享下面提及的 key:</p>
+
+<dl>
+ <dt><code>configurable</code></dt>
+ <dd><code>true</code> 則若且唯若此屬性則將可改變或刪除自相應物件。<br>
+ <strong>預設為 <code>false</code></strong></dd>
+ <dt><code>enumerable</code></dt>
+ <dd><code>true</code> 如果且唯若相應物件被列舉,將會列舉此屬性。<br>
+ <strong>預設為 <code>false</code></strong></dd>
+</dl>
+
+<p>一個 data descriptor 還有以下可選的 key:</p>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).<br>
+ <strong>預設 {{jsxref("undefined")}}.</strong></dd>
+ <dt><code>writable</code></dt>
+ <dd><code>true</code> 則該物件屬性可透過{{jsxref("Operators/Assignment_Operators", "賦予運算子", "", 1)}}改變其值。<br>
+ <strong>預設 <code>false</code></strong></dd>
+</dl>
+
+<p>一個 accessor descriptor 也擁有下述之 optional keys:</p>
+
+<dl>
+ <dt><code>get</code></dt>
+ <dd>作為 getter 形式,為屬性存在的函式,如果沒有 getter 的話則回傳 {{jsxref("undefined")}}。函式回傳將用於屬性值。<br>
+ <strong>預設 {{jsxref("undefined")}}</strong></dd>
+ <dt><code>set</code></dt>
+ <dd>作為 setter 形式,為屬性存在的函式,如果沒有 setter 的話則回傳 {{jsxref("undefined")}}。 The function will receive as only argument the new value being assigned to the property.<br>
+ <strong>預設 {{jsxref("undefined")}}</strong></dd>
+</dl>
+
+<p>請注意,這些選項並不一定要是 descriptor 屬性,由原型鍊(prototype chain)繼承的屬性,也會被考慮到。要確保需要凍結(freeze)的 {{jsxref("Object.prototype")}} upfront 預設能被保存,請明確指定所有選項,或把 {{jsxref("Object.prototype.__proto__", "__proto__")}} 屬性指向 {{jsxref("null")}}。</p>
+
+<pre class="brush: js">// using __proto__
+var obj = {};
+Object.defineProperty(obj, 'key', {
+ __proto__: null, // no inherited properties
+ value: 'static' // not enumerable
+ // not configurable
+ // not writable
+ // as defaults
+});
+
+// being explicit
+Object.defineProperty(obj, 'key', {
+ enumerable: false,
+ configurable: false,
+ writable: false,
+ value: 'static'
+});
+
+// recycling same object
+function withValue(value) {
+ var d = withValue.d || (
+ withValue.d = {
+ enumerable: false,
+ writable: false,
+ configurable: false,
+ value: null
+ }
+ );
+ d.value = value;
+ return d;
+}
+// ... and ...
+Object.defineProperty(obj, 'key', withValue('static'));
+
+// if freeze is available, prevents adding or
+// removing the object prototype properties
+// (value, get, set, enumerable, writable, configurable)
+(Object.freeze || Object)(Object.prototype);
+</pre>
+
+<h2 id="範例">範例</h2>
+
+<p>If you want to see how to use the <code>Object.defineProperty</code> method with a <em>binary-flags-like</em> syntax, see <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty/Additional_examples">additional examples</a>.</p>
+
+<h3 id="建立屬性">建立屬性</h3>
+
+<p>When the property specified doesn't exist in the object, <code>Object.defineProperty()</code> creates a new property as described. Fields may be omitted from the descriptor, and default values for those fields are imputed. All of the Boolean-valued fields default to <code>false</code>. The <code>value</code>, <code>get</code>, and <code>set</code> fields default to {{jsxref("undefined")}}. A property which is defined without <code>get</code>/<code>set</code>/<code>value</code>/<code>writable</code> is called “generic” and is “typed” as a data descriptor.</p>
+
+<pre class="brush: js">var o = {}; // Creates a new object
+
+// Example of an object property added with defineProperty with a data property descriptor
+Object.defineProperty(o, 'a', {
+ value: 37,
+ writable: true,
+ enumerable: true,
+ configurable: true
+});
+// 'a' property exists in the o object and its value is 37
+
+// Example of an object property added with defineProperty with an accessor property descriptor
+var bValue = 38;
+Object.defineProperty(o, 'b', {
+ get: function() { return bValue; },
+ set: function(newValue) { bValue = newValue; },
+ enumerable: true,
+ configurable: true
+});
+o.b; // 38
+// 'b' property exists in the o object and its value is 38
+// The value of o.b is now always identical to bValue, unless o.b is redefined
+
+// You cannot try to mix both:
+Object.defineProperty(o, 'conflict', {
+ value: 0x9f91102,
+ get: function() { return 0xdeadbeef; }
+});
+// throws a TypeError: value appears only in data descriptors, get appears only in accessor descriptors
+</pre>
+
+<h3 id="修改屬性">修改屬性</h3>
+
+<p>如果該屬性已經存在, <code>Object.defineProperty()</code> 將會根據描述符內的值和物件當前的 configuration 來修改屬性。 如果舊的描述符之 <code>configurable</code> 的特徵為 false (屬性為 “non-configurable”), 那除了 <code>writable</code> 之外的特徵都將無法修改。 在這個情況,也不可能在 data 和 accessor 屬性類型中來回切換。</p>
+
+<p>如果有一個屬性是 non-configurable, 那它的 <code>writable</code> 特徵只能被改變為 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">false</span></font>.</p>
+
+<p>若嘗試改變 non-configurable property attributes,將會丟出一個 {{jsxref("TypeError")}},除非當前之值與新值相同。</p>
+
+<h4 id="Writable_attribute">Writable attribute</h4>
+
+<p>當 <code>writable</code> 屬性特徵被設為 <code>false</code>, 此屬性為 “non-writable”. 它將無法被重新賦值。</p>
+
+<pre class="brush: js">var o = {}; // Creates a new object
+
+Object.defineProperty(o, 'a', {
+ value: 37,
+ writable: false
+});
+
+console.log(o.a); // logs 37
+o.a = 25; // No error thrown (it would throw in strict mode, even if the value had been the same)
+console.log(o.a); // logs 37. The assignment didn't work.
+</pre>
+
+<p>As seen in the example, trying to write into the non-writable property doesn't change it but doesn't throw an error either.</p>
+
+<h4 id="可列舉_attribute">可列舉 attribute</h4>
+
+<p>The <code>enumerable</code> property attribute defines whether the property shows up in a {{jsxref("Statements/for...in", "for...in")}} loop and {{jsxref("Object.keys()")}} or not.</p>
+
+<pre class="brush: js">var o = {};
+Object.defineProperty(o, 'a', { value: 1, enumerable: true });
+Object.defineProperty(o, 'b', { value: 2, enumerable: false });
+Object.defineProperty(o, 'c', { value: 3 }); // enumerable defaults to false
+o.d = 4; // enumerable defaults to true when creating a property by setting it
+
+for (var i in o) {
+ console.log(i);
+}
+// logs 'a' and 'd' (in undefined order)
+
+Object.keys(o); // ['a', 'd']
+
+o.propertyIsEnumerable('a'); // true
+o.propertyIsEnumerable('b'); // false
+o.propertyIsEnumerable('c'); // false
+</pre>
+
+<h4 id="可設定_attribute">可設定 attribute</h4>
+
+<p>The <code>configurable</code> attribute controls at the same time whether the property can be deleted from the object and whether its attributes (other than <code>writable</code>) can be changed.</p>
+
+<pre class="brush: js">var o = {};
+Object.defineProperty(o, 'a', {
+ get: function() { return 1; },
+ configurable: false
+});
+
+Object.defineProperty(o, 'a', { configurable: true }); // throws a TypeError
+Object.defineProperty(o, 'a', { enumerable: true }); // throws a TypeError
+Object.defineProperty(o, 'a', { set: function() {} }); // throws a TypeError (set was undefined previously)
+Object.defineProperty(o, 'a', { get: function() { return 1; } }); // throws a TypeError (even though the new get does exactly the same thing)
+Object.defineProperty(o, 'a', { value: 12 }); // throws a TypeError
+
+console.log(o.a); // logs 1
+delete o.a; // Nothing happens
+console.log(o.a); // logs 1
+</pre>
+
+<p>If the <code>configurable</code> attribute of <code>o.a</code> had been <code>true</code>, none of the errors would be thrown and the property would be deleted at the end.</p>
+
+<h3 id="新增多個屬性及賦予初始值">新增多個屬性及賦予初始值</h3>
+
+<p>It's important to consider the way default values of attributes are applied. There is often a difference between simply using dot notation to assign a value and using <code>Object.defineProperty()</code>, as shown in the example below.</p>
+
+<pre class="brush: js">var o = {};
+
+o.a = 1;
+// is equivalent to:
+Object.defineProperty(o, 'a', {
+ value: 1,
+ writable: true,
+ configurable: true,
+ enumerable: true
+});
+
+
+// On the other hand,
+Object.defineProperty(o, 'a', { value: 1 });
+// is equivalent to:
+Object.defineProperty(o, 'a', {
+ value: 1,
+ writable: false,
+ configurable: false,
+ enumerable: false
+});
+</pre>
+
+<h3 id="Custom_Setters_and_Getters">Custom Setters and Getters</h3>
+
+<p>Example below shows how to implement a self-archiving object. When <code>temperature</code> property is set, the <code>archive</code> array gets a log entry.</p>
+
+<pre class="brush: js">function Archiver() {
+ var temperature = null;
+ var archive = [];
+
+ Object.defineProperty(this, 'temperature', {
+ get: function() {
+ console.log('get!');
+ return temperature;
+ },
+ set: function(value) {
+ temperature = value;
+ archive.push({ val: temperature });
+ }
+ });
+
+ this.getArchive = function() { return archive; };
+}
+
+var arc = new Archiver();
+arc.temperature; // 'get!'
+arc.temperature = 11;
+arc.temperature = 13;
+arc.getArchive(); // [{ val: 11 }, { val: 13 }]
+</pre>
+
+<p>or</p>
+
+<pre class="brush: js">var pattern = {
+ get: function () {
+ return 'I always return this string, whatever you have assigned';
+ },
+ set: function () {
+ this.myname = 'this is my name string';
+ }
+};
+
+
+function TestDefineSetAndGet() {
+ Object.defineProperty(this, 'myproperty', pattern);
+}
+
+
+var instance = new TestDefineSetAndGet();
+instance.myproperty = 'test';
+console.log(instance.myproperty); // I always return this string, whatever you have assigned
+
+console.log(instance.myname); // this is my name string
+
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">註記</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.6', 'Object.defineProperty')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.defineproperty', 'Object.defineProperty')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.defineproperty', 'Object.defineProperty')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Object.defineProperty")}}</p>
+</div>
+
+<h2 id="Compatibility_notes">Compatibility notes</h2>
+
+<h3 id="Redefining_the_length_property_of_an_Array_object">Redefining the <code>length</code> property of an <code>Array</code> object</h3>
+
+<p>It is possible to redefine the {{jsxref("Array.length", "length")}} property of arrays, subject to the usual redefinition restrictions. (The {{jsxref("Array.length", "length")}} property is initially non-configurable, non-enumerable, and writable. Thus on an unaltered array, it's possible to change the {{jsxref("Array.length", "length")}} property's value or to make it non-writable. It is not allowed to change its enumerability or configurability, or if it is non-writable to change its value or writability.) However, not all browsers permit this redefinition.</p>
+
+<p>Firefox 4 through 22 will throw a {{jsxref("TypeError")}} on any attempt whatsoever (whether permitted or not) to redefine the {{jsxref("Array.length", "length")}} property of an array.</p>
+
+<p>Versions of Chrome which implement <code>Object.defineProperty()</code> in some circumstances ignore a length value different from the array's current {{jsxref("Array.length", "length")}} property. In some circumstances changing writability seems to silently not work (and not throw an exception). Also, relatedly, some array-mutating methods like {{jsxref("Array.prototype.push")}} don't respect a non-writable length.</p>
+
+<p>Versions of Safari which implement <code>Object.defineProperty()</code> ignore a <code>length</code> value different from the array's current {{jsxref("Array.length", "length")}} property, and attempts to change writability execute without error but do not actually change the property's writability.</p>
+
+<p>Only Internet Explorer 9 and later, and Firefox 23 and later, appear to fully and correctly implement redefinition of the {{jsxref("Array.length", "length")}} property of arrays. For now, don't rely on redefining the {{jsxref("Array.length", "length")}} property of an array to either work, or to work in a particular manner. And even when you <em>can</em> rely on it, <a href="http://whereswalden.com/2013/08/05/new-in-firefox-23-the-length-property-of-an-array-can-be-made-non-writable-but-you-shouldnt-do-it/">there's really no good reason to do so</a>.</p>
+
+<h3 id="Internet_Explorer_8_specific_notes">Internet Explorer 8 specific notes</h3>
+
+<p>Internet Explorer 8 implemented a <code>Object.defineProperty()</code> method that could <a class="external" href="https://msdn.microsoft.com/en-us/library/dd229916%28VS.85%29.aspx">only be used on DOM objects</a>. A few things need to be noted:</p>
+
+<ul>
+ <li>Trying to use <code>Object.defineProperty()</code> on native objects throws an error.</li>
+ <li>Property attributes must be set to some values. The <code>configurable</code>, <code>enumerable</code> and <code>writable</code> attributes should all be set to <code>true</code> for data descriptor and <code>true</code> for <code>configurable</code>, <code>false</code> for <code>enumerable</code> for accessor descriptor.(?) Any attempt to provide other value(?) will result in an error being thrown.</li>
+ <li>Reconfiguring a property requires first deleting the property. If the property isn't deleted, it stays as it was before the reconfiguration attempt.</li>
+</ul>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+ <li>{{jsxref("Object.defineProperties()")}}</li>
+ <li>{{jsxref("Object.propertyIsEnumerable()")}}</li>
+ <li>{{jsxref("Object.getOwnPropertyDescriptor()")}}</li>
+ <li>{{jsxref("Object.prototype.watch()")}}</li>
+ <li>{{jsxref("Object.prototype.unwatch()")}}</li>
+ <li>{{jsxref("Operators/get", "get")}}</li>
+ <li>{{jsxref("Operators/set", "set")}}</li>
+ <li>{{jsxref("Object.create()")}}</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty/Additional_examples">Additional <code>Object.defineProperty</code> examples</a></li>
+ <li>{{jsxref("Reflect.defineProperty()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/freeze/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/freeze/index.html
new file mode 100644
index 0000000000..0c26b9f308
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/freeze/index.html
@@ -0,0 +1,198 @@
+---
+title: Object.freeze()
+slug: Web/JavaScript/Reference/Global_Objects/Object/freeze
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/freeze
+---
+<div>{{JSRef}}</div>
+
+<p> </p>
+
+<p><code><strong>Object.freeze()</strong></code> 顧名思義是用來「凍結」一個物件的: 也就是防止物件新增屬性; 防止物件既有的屬性被刪除; 防止物件原本的屬性, 還有屬性的可列舉性, 可設定性, 可寫性被改動; 同時它也防止物件的原型被改變。此方法回傳一個凍結狀態的物件。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/object-freeze.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Object.freeze(<var>obj</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>要被凍結的物件</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>被凍結的物件</p>
+
+<h2 id="描述">描述</h2>
+
+<p>一個被凍結的物件無法被新增或刪除屬性。任何想要改動的嘗試都會失敗, 要不沈默地失敗, 就是丟出一個 {{jsxref("TypeError")}} 例外 (此例外最常出現在 {{jsxref("Strict_mode", "strict mode", "", 1)}})</p>
+
+<p>資料屬性無法被改變。訪問者方法 - setters 也一樣不能改變資料屬性 (雖然它會給你可以改變資料值的假象)。注意! 如果資料屬性是物件的話,該物件的值是可以被改變的,除非它們也被凍結。一個陣列同樣可以被凍結 (因為它也是一個物件),被凍結後它的元素內容就不能被改變,也不能新增或刪除元素。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="凍結物件">凍結物件</h3>
+
+<pre class="brush: js">var obj = {
+ prop: function() {},
+ foo: 'bar'
+};
+
+// 新的屬性可以被新增,原本的屬性可以被改變或刪除
+obj.foo = 'baz';
+obj.lumpy = 'woof';
+delete obj.prop;
+
+// 回傳的物件跟原本傳入的物件是同一個,所以不需要記住回傳值
+// 也可以凍結一個物件
+var o = Object.freeze(obj);
+
+o === obj; // true
+Object.isFrozen(obj); // === true
+
+// 現在任何改動都會失敗
+obj.foo = 'quux'; // 什麼事也不會發生
+// 屬性無法被新增
+obj.quaxxor = 'the friendly duck';
+
+// 在嚴格模式中,如方才的嘗試都會丟出 TypeError
+function fail(){
+ 'use strict';
+ obj.foo = 'sparky'; // 丟出 TypeError
+ delete obj.foo; // 丟出 TypeError
+ delete obj.quaxxor; // 回傳 true 因為屬性 'quaxxor' 從來沒有被新增
+ obj.sparky = 'arf'; // 丟出 TypeError
+}
+
+fail();
+
+// 嘗試透過 Object.defineProperty 來改變屬性的值會丟出 TypeError
+Object.defineProperty(obj, 'ohai', { value: 17 });
+Object.defineProperty(obj, 'foo', { value: 'eit' });
+
+// 一樣不可能改變物件的原型,都會丟出 TypeError
+Object.setPrototypeOf(obj, { x: 20 })
+obj.__proto__ = { x: 20 }
+</pre>
+
+<h3 id="凍結陣列">凍結陣列</h3>
+
+<pre>let a = [0];
+Object.freeze(a); // 現在這個陣列不能被改動
+
+a[0]=1; // 沈默地失敗
+a.push(2); // 沈默地失敗
+
+// 在嚴格模式底下會丟出 TypeError
+function fail() {
+ "use strict"
+ a[0] = 1;
+ a.push(2);
+}
+
+fail();</pre>
+
+<p>被凍結的物件是<em>不可變 (Immutable) </em>的。然而,它並不等於常數<em> (constant)</em>。以下的範例顯示一個被凍結的物件並不是常數 (凍結的動作是「淺」的 - 如果資料屬性也是物件, 不會遞迴地做凍結的動作)。</p>
+
+<pre class="brush: js">obj1 = {
+ internal: {}
+};
+
+Object.freeze(obj1);
+obj1.internal.a = 'aValue';
+
+obj1.internal.a // 'aValue'</pre>
+
+<p class="brush: js">如果要成為一個常數物件,整個物件參考圖 (包含直接指向或間接指向其他物件) 必須都只能指向被凍結的不可變物件。一個物件被稱作不可變是因為它的整個物件狀態 (值或是指向其他物件的參考) 是固定的。注意,string, number 和 boolean 這些原始型別的值是永遠不變的,Function 和 Array 都屬於物件的一種。</p>
+
+<p class="brush: js">要讓一個物件變成常數物件,就必須遞迴地凍結每個是物件型別的屬性 (稱作深凍結)。只有當你知道物件的參考圖不存在任何<em><a href="https://en.wikipedia.org/wiki/Cycle_(graph_theory)">循環</a> </em>的時候才能使用以上遞迴的方式來凍結物件,不然就可能會造成無窮迴圈。一個改善以下範例中 deepFreeze() 來解決無窮迴圈問題的方法是 - 創建一個接受一個路徑參數 (像是陣列) 的內部用函數,用來避免無窮遞迴地呼叫 deepFreeze() - 當發現欲凍結的物件已經出現在之前凍結的物件行列中就不繼續遞迴下去。需要注意的是你可能會不小心凍結一個不應該被凍結的物件,像是 [window]。</p>
+
+<pre class="brush: js">// 用這個函數來進行對物件的深凍結
+function deepFreeze(obj) {
+
+ // 取得物件的所有屬性名稱
+ var propNames = Object.getOwnPropertyNames(obj);
+
+ // 在凍結物件本身之前先凍結物件的所有物件屬性
+ propNames.forEach(function(name) {
+ var prop = obj[name];
+
+ // 凍結 prop 如果它是一個物件
+ if (typeof prop == 'object' &amp;&amp; prop !== null)
+ deepFreeze(prop);
+ });
+
+ // 凍結本身 (no-op 如果已經被凍結了)
+ return Object.freeze(obj);
+}
+
+obj2 = {
+ internal: {}
+};
+
+deepFreeze(obj2);
+obj2.internal.a = 'anotherValue';
+obj2.internal.a; // undefined</pre>
+
+<h2 id="備註">備註</h2>
+
+<p>在 ES5 中,如果傳入此方法的參數不是一個物件 (原始型別),{{jsxref("TypeError")}} 就會被丟出。而在 ES2015,一個非物件型態的參數會被當成是一個已經被凍結的物件,所以會被直接回傳?不會造成錯誤。</p>
+
+<pre class="brush: js">&gt; Object.freeze(1)
+TypeError: 1 is not an object // ES5 code
+
+&gt; Object.freeze(1)
+1 // ES2015 code
+</pre>
+
+<h3 id="與_Object.seal()_的差別">與 <code>Object.seal()</code> 的差別</h3>
+
+<p>被 <code>Object.seal()</code> 密封的物件還是可以改變它原有屬性的值。而被 <code>Object.freeze()</code> 凍結的物件則無法改變它原有屬性的值因為他們是不可變的。</p>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.9', 'Object.freeze')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>第一版。實作於 JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.freeze', 'Object.freeze')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.freeze', 'Object.freeze')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Object.freeze")}}</p>
+</div>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{jsxref("Object.isFrozen()")}}</li>
+ <li>{{jsxref("Object.preventExtensions()")}}</li>
+ <li>{{jsxref("Object.isExtensible()")}}</li>
+ <li>{{jsxref("Object.seal()")}}</li>
+ <li>{{jsxref("Object.isSealed()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html
new file mode 100644
index 0000000000..ff4e4d480f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/getprototypeof/index.html
@@ -0,0 +1,128 @@
+---
+title: Object.getPrototypeOf()
+slug: Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf
+tags:
+ - JavaScript
+ - Method
+ - Object
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.getPrototypeOf()</strong></code> 回傳指定物件的原型,換句話說,就是取得該物件的 <code>[[Prototype]]</code> 屬性的值).</p>
+
+<h2 id="表達式">表達式</h2>
+
+<pre class="syntaxbox"><code>Object.getPrototypeOf(<var>obj</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>欲取得原型的物件。</dd>
+</dl>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var proto = {};
+var obj = Object.create(proto);
+Object.getPrototypeOf(obj) === proto; // true
+</pre>
+
+<h2 id="備註">備註</h2>
+
+<p>如果 <code>obj</code> 參數在 ES5 並不是物件時會拋出 {{jsxref("TypeError")}} 例外,同樣狀況在 ES6 時該參數將會被強制轉換成 {{jsxref("Object")}}。</p>
+
+<pre class="brush: js">Object.getPrototypeOf("foo");
+// TypeError: "foo" is not an object (ES5 code)
+Object.getPrototypeOf("foo");
+// String.prototype (ES6 code)
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.2', 'Object.getPrototypeOf')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.getprototypeof', 'Object.getProtoypeOf')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatGeckoDesktop("1.9.1")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("12.10")}}</td>
+ <td>{{CompatSafari("5")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Opera_註">Opera 註</h2>
+
+<p>雖然舊版的 Opera 並不支援 <code>Object.getPrototypeOf()</code>,但是 Opera 從 Opera 10.50 支援非標準的 {{jsxref("Object.proto", "__proto__")}} 屬性。</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Object.prototype.isPrototypeOf()")}}</li>
+ <li>{{jsxref("Object.setPrototypeOf()")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Object.prototype.__proto__")}}</li>
+ <li>John Resig 的文章--《 <a class="external" href="http://ejohn.org/blog/objectgetprototypeof/">getPrototypeOf</a> 》</li>
+ <li>{{jsxref("Reflect.getPrototypeOf()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html
new file mode 100644
index 0000000000..1786387141
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/hasownproperty/index.html
@@ -0,0 +1,184 @@
+---
+title: Object.prototype.hasOwnProperty()
+slug: Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
+tags:
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>hasOwnProperty()</strong></code> 回傳物件是否有該屬性的布林值。</p>
+
+<h2 id="表達式">表達式</h2>
+
+<pre class="syntaxbox"><code><var>obj</var>.hasOwnProperty(<var>prop</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>prop</code></dt>
+ <dd>屬性名稱。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>每個為 {{jsxref("Object")}} 後代的物件都繼承 <code>hasOwnProperty</code> 方法。這個方法可以被使用來決定物件是否擁有特定的直接屬性;跟 {{jsxref("Operators/in", "in")}} 不一樣,這個方法並未檢查物件的原型鏈。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_hasOwnProperty_測試屬性是否存在">使用 <code>hasOwnProperty</code> 測試屬性是否存在</h3>
+
+<p>這個範例顯示 <code>o </code>物件是否擁有名為 <code>prop </code>的屬性:</p>
+
+<pre class="brush: js">o = new Object();
+o.prop = 'exists';
+
+function changeO() {
+ o.newprop = o.prop;
+ delete o.prop;
+}
+
+o.hasOwnProperty('prop'); // 回傳 true
+changeO();
+o.hasOwnProperty('prop'); // 回傳 false
+</pre>
+
+<h3 id="直接與繼承的屬性">直接與繼承的屬性</h3>
+
+<p>這個範例區分直接屬性和從原型鍊繼承的屬性:</p>
+
+<pre class="brush: js">o = new Object();
+o.prop = 'exists';
+o.hasOwnProperty('prop'); // 回傳 true
+o.hasOwnProperty('toString'); // 回傳 false
+o.hasOwnProperty('hasOwnProperty'); // 回傳 false
+</pre>
+
+<h3 id="遍歷物件的屬性">遍歷物件的屬性</h3>
+
+<p>這個範例顯示如何不執行繼承的屬性去遍歷物件的屬性。注意 {{jsxref("Statements/for...in", "for...in")}} 已經遍歷了可以被列舉的項目,所以不該基於缺乏不可列舉的屬性(如下)而假設 <code>hasOwnProperty</code> 被嚴格地限制在列舉的項目(如同 {{jsxref("Object.getOwnPropertyNames()")}})。</p>
+
+<pre class="brush: js">var buz = {
+ fog: 'stack'
+};
+
+for (var name in buz) {
+ if (buz.hasOwnProperty(name)) {
+ console.log('this is fog (' + name + ') for sure. Value: ' + buz[name]);
+ }
+ else {
+ console.log(name); // toString or something else
+ }
+}
+</pre>
+
+<h3 id="將_hasOwnProperty_作為屬性"><code>將 hasOwnProperty</code> 作為屬性</h3>
+
+<p>JavaScript 並未保護 <code>hasOwnProperty</code>;因此,如果一個物件擁有一樣的屬性名稱,為了獲得正確的結果需要使用 <em>external</em> <code>hasOwnProperty</code>:</p>
+
+<pre class="brush: js">var foo = {
+ hasOwnProperty: function() {
+ return false;
+ },
+ bar: 'Here be dragons'
+};
+
+foo.hasOwnProperty('bar'); // 總是回傳 false
+
+// 使用其他物件的 hasOwnProperty 和 call it with 'this' set to foo
+({}).hasOwnProperty.call(foo, 'bar'); // true
+
+// 從物件的原型使用 hasOwnProperty 也是可行的
+Object.prototype.hasOwnProperty.call(foo, 'bar'); // true
+</pre>
+
+<p>註:在最後一個例子中並未創建任何新的物件。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.4.5', 'Object.prototype.hasOwnProperty')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.prototype.hasownproperty', 'Object.prototype.hasOwnProperty')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+ <li>{{jsxref("Object.getOwnPropertyNames()")}}</li>
+ <li>{{jsxref("Statements/for...in", "for...in")}}</li>
+ <li>{{jsxref("Operators/in", "in")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide/Inheritance_Revisited">JavaScript Guide: Inheritance revisited</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/index.html
new file mode 100644
index 0000000000..3885c44a15
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/index.html
@@ -0,0 +1,222 @@
+---
+title: Object
+slug: Web/JavaScript/Reference/Global_Objects/Object
+tags:
+ - Constructor
+ - JavaScript
+ - NeedsTranslation
+ - Object
+ - TopicStub
+translation_of: Web/JavaScript/Reference/Global_Objects/Object
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object</strong></code> 建構式可用於建立物件包裝(object wrapper)。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">// Object initialiser or literal
+{ [ <var>nameValuePair1</var>[, <var>nameValuePair2</var>[, ...<var>nameValuePairN</var>] ] ] }
+
+// Called as a constructor
+new Object([<var>value</var>])</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>nameValuePair1, nameValuePair2, ... nameValuePair<em>N</em></code></dt>
+ <dd>Pairs of names (strings) and values (any value) where the name is separated from the value by a colon.</dd>
+ <dt><code>value</code></dt>
+ <dd>任意值。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>The <code>Object</code> constructor creates an object wrapper for the given value. If the value is {{jsxref("null")}} or {{jsxref("undefined")}}, it will create and return an empty object, otherwise, it will return an object of a Type that corresponds to the given value. If the value is an object already, it will return the value.</p>
+
+<p>When called in a non-constructor context, <code>Object</code> behaves identically to <code>new Object()</code>.</p>
+
+<p>也可以參考 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer / literal syntax</a>.</p>
+
+<h2 id="Object_建構式屬性"><code>Object</code> 建構式屬性</h2>
+
+<dl>
+ <dt><code>Object.length</code></dt>
+ <dd>Has a value of 1.</dd>
+ <dt>{{jsxref("Object.prototype")}}</dt>
+ <dd>Allows the addition of properties to all objects of type Object.</dd>
+</dl>
+
+<h2 id="Object_建構式方法"><code>Object</code> 建構式方法</h2>
+
+<dl>
+ <dt>{{jsxref("Object.assign()")}}</dt>
+ <dd>Creates a new object by copying the values of all enumerable own properties from one or more source objects to a target object.</dd>
+ <dt>{{jsxref("Object.create()")}}</dt>
+ <dd>Creates a new object with the specified prototype object and properties.</dd>
+ <dt>{{jsxref("Object.defineProperty()")}}</dt>
+ <dd>Adds the named property described by a given descriptor to an object.</dd>
+ <dt>{{jsxref("Object.defineProperties()")}}</dt>
+ <dd>Adds the named properties described by the given descriptors to an object.</dd>
+ <dt>{{jsxref("Object.entries()")}} {{experimental_inline}}</dt>
+ <dd>Returns an array of a given object's own enumerable property <code>[key, value]</code> pairs.</dd>
+ <dt>{{jsxref("Object.freeze()")}}</dt>
+ <dd>Freezes an object: other code can't delete or change any properties.</dd>
+ <dt>{{jsxref("Object.getOwnPropertyDescriptor()")}}</dt>
+ <dd>Returns a property descriptor for a named property on an object.</dd>
+ <dt>{{jsxref("Object.getOwnPropertyDescriptors()")}}</dt>
+ <dd>Returns an object containing all own property descriptors for an object.</dd>
+ <dt>{{jsxref("Object.getOwnPropertyNames()")}}</dt>
+ <dd>Returns an array containing the names of all of the given object's <strong>own</strong> enumerable and non-enumerable properties.</dd>
+ <dt>{{jsxref("Object.getOwnPropertySymbols()")}}</dt>
+ <dd>Returns an array of all symbol properties found directly upon a given object.</dd>
+ <dt>{{jsxref("Object.getPrototypeOf()")}}</dt>
+ <dd>Returns the prototype of the specified object.</dd>
+ <dt>{{jsxref("Object.is()")}}</dt>
+ <dd>Compares if two values are distinguishable (ie. the same)</dd>
+ <dt>{{jsxref("Object.isExtensible()")}}</dt>
+ <dd>Determines if extending of an object is allowed.</dd>
+ <dt>{{jsxref("Object.isFrozen()")}}</dt>
+ <dd>Determines if an object was frozen.</dd>
+ <dt>{{jsxref("Object.isSealed()")}}</dt>
+ <dd>Determines if an object is sealed.</dd>
+ <dt>{{jsxref("Object.keys()")}}</dt>
+ <dd>Returns an array containing the names of all of the given object's <strong>own</strong> enumerable properties.</dd>
+ <dt>{{jsxref("Object.preventExtensions()")}}</dt>
+ <dd>Prevents any extensions of an object.</dd>
+ <dt>{{jsxref("Object.seal()")}}</dt>
+ <dd>Prevents other code from deleting properties of an object.</dd>
+ <dt>{{jsxref("Object.setPrototypeOf()")}}</dt>
+ <dd>Sets the prototype (i.e., the internal <code>[[Prototype]]</code> property)</dd>
+ <dt>{{jsxref("Object.values()")}} {{experimental_inline}}</dt>
+ <dd>Returns an array of a given object's own enumerable values.</dd>
+</dl>
+
+<h2 id="Object_物件實體與_Object_原型物件"><code>Object</code> 物件實體與 <code>Object</code> 原型物件</h2>
+
+<p>All objects in JavaScript are descended from <code>Object</code>; all objects inherit methods and properties from {{jsxref("Object.prototype")}}, although they may be overridden. For example, other constructors' prototypes override the <code>constructor</code> property and provide their own <code>toString()</code> methods. Changes to the <code>Object</code> prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.</p>
+
+<h3 id="屬性">屬性</h3>
+
+<div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', '屬性') }}</div>
+
+<h3 id="方法">方法</h3>
+
+<div>{{page('/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype', '方法') }}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Using_Object_given_undefined_and_null_types">Using <code>Object</code> given <code>undefined</code> and <code>null</code> types</h3>
+
+<p>下面例子儲存一個空物件至變數o</p>
+
+<pre class="brush: js notranslate">var o = new Object();
+</pre>
+
+<pre class="brush: js notranslate">var o = new Object(undefined);
+</pre>
+
+<pre class="brush: js notranslate">var o = new Object(null);
+</pre>
+
+<h3 id="Using_Object_to_create_Boolean_objects">Using <code>Object</code> to create <code>Boolean</code> objects</h3>
+
+<p>下面例子儲存 {{jsxref("Boolean")}} 物件在 <code>o</code>:</p>
+
+<pre class="brush: js notranslate">// equivalent to o = new Boolean(true);
+var o = new Object(true);
+</pre>
+
+<pre class="brush: js notranslate">// equivalent to o = new Boolean(false);
+var o = new Object(Boolean());
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2', 'Object')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object-objects', 'Object')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Added Object.assign, Object.getOwnPropertySymbols, Object.setPrototypeOf, Object.is</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object-objects', 'Object')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Added Object.entries, Object.values and Object.getOwnPropertyDescriptors.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Object_initializer">Object initializer</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html
new file mode 100644
index 0000000000..958b9a3a47
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/keys/index.html
@@ -0,0 +1,208 @@
+---
+title: Object.keys()
+slug: Web/JavaScript/Reference/Global_Objects/Object/keys
+tags:
+ - ECMAScript 5
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/keys
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.keys()</strong></code> 方法會回傳一個由指定物件所有可列舉之屬性組成的陣列,該陣列中的的排列順序與使用 {{jsxref("Statements/for...in", "for...in")}} 進行迭代的順序相同(兩者的差異在於 <code>for-in</code> 迴圈還會迭代出物件自其原型鏈所繼承來的可列舉屬性)。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Object.keys(<var>obj</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>物件,用以回傳其可列舉屬性。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>回傳一個包含給定物件內所有可列舉屬性的字串陣列。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Object.keys()</code> 回傳一個陣列,陣列中的各元素為直屬於 <code>obj</code> ,對應可列舉屬性名的字串。回傳結果的排序,與手動對物件屬性作迴圈迭代的結果排序相同。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var arr = ['a', 'b', 'c'];
+console.log(Object.keys(arr)); // console: ['0', '1', '2']
+
+// 類似陣列的物件
+var obj = { 0: 'a', 1: 'b', 2: 'c' };
+console.log(Object.keys(obj)); // console: ['0', '1', '2']
+
+// 擁有隨機 key 排序,類似陣列的物件
+var an_obj = { 100: 'a', 2: 'b', 7: 'c' };
+console.log(Object.keys(an_obj)); // console: ['2', '7', '100']
+
+// getFoo 不是可列舉的屬性
+var my_obj = Object.create({}, {
+  getFoo: {
+  value: function() { return this.foo; }
+ }
+});
+my_obj.foo = 1;
+
+console.log(Object.keys(my_obj)); // console: ['foo']
+</pre>
+
+<p>如果想取得物件的所有屬性,包括非可列舉的屬性,請參閱 {{jsxref("Object.getOwnPropertyNames()")}}.</p>
+
+<h2 id="備註">備註</h2>
+
+<p>在 ES5 中,如果這個方法的參數不是一個標準物件(例如原始型別),將會產生 {{jsxref("TypeError")}}錯誤。而在 ES2015,非物件的參數將會強制轉換成物件。</p>
+
+<pre class="brush: js">Object.keys("foo");
+// TypeError: "foo" is not an object (ES5 code)
+
+Object.keys("foo");
+// ["0", "1", "2"] (ES2015 code)
+</pre>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>如需在原生不支援、較舊的環境中增加 <code>Object.keys</code> 的相容性,請複製以下片段:</p>
+
+<pre class="brush: js">// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
+if (!Object.keys) {
+ Object.keys = (function() {
+ 'use strict';
+ var hasOwnProperty = Object.prototype.hasOwnProperty,
+ hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
+ dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ],
+ dontEnumsLength = dontEnums.length;
+
+ return function(obj) {
+ if (typeof obj !== 'object' &amp;&amp; (typeof obj !== 'function' || obj === null)) {
+ throw new TypeError('Object.keys called on non-object');
+ }
+
+ var result = [], prop, i;
+
+ for (prop in obj) {
+ if (hasOwnProperty.call(obj, prop)) {
+ result.push(prop);
+ }
+ }
+
+ if (hasDontEnumBug) {
+ for (i = 0; i &lt; dontEnumsLength; i++) {
+ if (hasOwnProperty.call(obj, dontEnums[i])) {
+ result.push(dontEnums[i]);
+ }
+ }
+ }
+ return result;
+ };
+ }());
+}
+</pre>
+
+<p>請注意以上的代碼片段在 IE7 中( IE8 也有可能 ),從不同的 window 傳入物件將包含非可列舉的 key 。</p>
+
+<p>較精簡的瀏覽器 Polyfill,請參閱 <a href="http://tokenposts.blogspot.com.au/2012/04/javascript-objectkeys-browser.html">Javascript - Object.keys Browser Compatibility</a>.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.14', 'Object.keys')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-object.keys', 'Object.keys')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.keys', 'Object.keys')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("5")}}</td>
+ <td>{{CompatGeckoDesktop("2.0")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("12")}}</td>
+ <td>{{CompatSafari("5")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+ <li>{{jsxref("Object.prototype.propertyIsEnumerable()")}}</li>
+ <li>{{jsxref("Object.create()")}}</li>
+ <li>{{jsxref("Object.getOwnPropertyNames()")}}</li>
+ <li>{{jsxref("Object.values()")}} {{experimental_inline}}</li>
+ <li>{{jsxref("Object.entries()")}} {{experimental_inline}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html
new file mode 100644
index 0000000000..bc046cf87b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/preventextensions/index.html
@@ -0,0 +1,179 @@
+---
+title: Object.preventExtensions()
+slug: Web/JavaScript/Reference/Global_Objects/Object/preventExtensions
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/preventExtensions
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.preventExtensions()</strong></code> 用來避免物件被新增新的屬性。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>Object.preventExtensions(<var>obj</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>要被用作無法擴充的物件。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>物件如果可以被增加新的屬性,我們稱它可以被擴充(extensible)。<code>Object.preventExtensions()</code> 標註物件使它無法被擴充,所以在它被標註為無法擴充當下,它將無法再增加新的屬性。不過注意一點,在一般狀況下,被標註為無法擴充的物件,其屬性仍可被刪除(<em>deleted</em>)。嘗試去增加屬性將會導致失敗,可能會沒有結果產生,或是傳回一個 {{jsxref("TypeError")}} (最常見,但並不是一定,當在{{jsxref("Functions_and_function_scope/Strict_mode", "strict mode", "", 1)}})。</p>
+
+<p><code>Object.preventExtensions() 只有避免物件被增加屬性,屬性仍可以被增加至 </code>object prototype 。不過,呼叫 <code>Object.preventExtensions() 使用在物件上,就可以使其 </code>{{jsxref("Object.proto", "__proto__")}} {{deprecated_inline}} 屬性無法被擴充。</p>
+
+<p>如果能把可擴充物件,轉成無法擴充物件,在 ECMAScript 5 規範中,它並沒有任何方法轉回來。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">// Object.preventExtensions 傳回一個被無法擴充的物件
+var obj = {};
+var obj2 = Object.preventExtensions(obj);
+obj === obj2; // true
+
+// 預設下,物件可以被擴充
+var empty = {};
+Object.isExtensible(empty); // === true
+
+// ...但是以下情況之後,無法再被變更。
+Object.preventExtensions(empty);
+Object.isExtensible(empty); // === false
+
+// Object.defineProperty throws 當為無法擴充的物件增加屬性
+var nonExtensible = { removable: true };
+Object.preventExtensions(nonExtensible);
+Object.defineProperty(nonExtensible, 'new', { value: 8675309 }); // throws a TypeError
+
+// 在 strict mode 中,嘗試去新增屬性給無法擴充物件,將 throws 出一個 TypeError。
+function fail() {
+ 'use strict';
+ nonExtensible.newProperty = 'FAIL'; // throws a TypeError
+}
+fail();
+
+// EXTENSION (only works in engines supporting __proto__
+// (which is deprecated. Use Object.getPrototypeOf instead)):
+// A non-extensible object's prototype is immutable.
+var fixed = Object.preventExtensions({});
+fixed.__proto__ = { oh: 'hai' }; // throws a TypeError
+</pre>
+
+<h2 id="筆記">筆記</h2>
+
+<p>在ES5中,如果給祝個方法的參數為非物件,它將造成一個 {{jsxref("TypeError")}} 。不過在 ES6 中,非物件參數會被正常處理。另外,如果它原本就是個無法擴充物件,就只是回傳本身。</p>
+
+<pre class="brush: js">Object.preventExtensions(1);
+// TypeError: 1 is not an object (ES5 code)
+
+Object.preventExtensions(1);
+// 1 (ES6 code)
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.10', 'Object.preventExtensions')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.preventextensions', 'Object.preventExtensions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.preventextensions', 'Object.preventExtensions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容度">瀏覽器相容度</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("6")}}</td>
+ <td>{{CompatGeckoDesktop("2.0")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("12")}}</td>
+ <td>{{CompatSafari("5.1")}}</td>
+ </tr>
+ <tr>
+ <td>ES6 behavior for non-object argument</td>
+ <td>{{CompatChrome("44")}}</td>
+ <td>{{CompatGeckoDesktop("35.0")}}</td>
+ <td>{{CompatIE("11")}}</td>
+ <td>{{CompatOpera("31")}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>ES6 behavior for non-object argument</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("35.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="閱讀更多">閱讀更多</h2>
+
+<ul>
+ <li>{{jsxref("Object.isExtensible()")}}</li>
+ <li>{{jsxref("Object.seal()")}}</li>
+ <li>{{jsxref("Object.isSealed()")}}</li>
+ <li>{{jsxref("Object.freeze()")}}</li>
+ <li>{{jsxref("Object.isFrozen()")}}</li>
+ <li>{{jsxref("Reflect.preventExtensions()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html
new file mode 100644
index 0000000000..5ba5c8f615
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/proto/index.html
@@ -0,0 +1,137 @@
+---
+title: Object.prototype.__proto__
+slug: Web/JavaScript/Reference/Global_Objects/Object/proto
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/proto
+---
+<div class="warning">
+<p><strong>Warning:</strong> 基於現代Javascript引擎最佳化物件屬性存取的方法,改變一個物件的 <code>[[Prototype]]</code> 在任何瀏覽器或是Javascript引擎都是非常慢的操作?。改變繼承屬性對效能的影響微妙且深遠,不僅僅只是影響執行 <code>obj.__proto__ = ...</code> 的時間,而是會影響到所有有存取到被改變 <code>[[Prototype]]</code> 的物件的程式碼的執行時間。如果你在乎效能的話就應該避免改變一個物件的 <code>[[Prototype]]</code> 。反之,請用 {{jsxref("Object.create()")}} 來產生一個擁有 <code>[[Prototype]]</code> 的物件。</p>
+</div>
+
+<div class="warning">
+<p><strong>Warning:</strong> 雖然 <code>Object.prototype.__proto__</code> 在今日已經被絕大部分的瀏覽器所支援,其存在與確切的行為只有在 ECMAScript 2015 規範才被標準化成一個歷史功能來確保相容性。為了更好的支援,建議使用{{jsxref("Object.getPrototypeOf()")}}。</p>
+</div>
+
+<div>{{JSRef}}</div>
+
+<p>The <code>__proto__</code> property of {{jsxref("Object.prototype")}} is an accessor property (a getter function and a setter function) that exposes the internal <code>[[Prototype]]</code> (either an object or {{jsxref("Global_Objects/null", "null")}}) of the object through which it is accessed.</p>
+
+<p>The use of <code>__proto__</code> is controversial, and has been discouraged. It was never originally included in the EcmaScript language spec, but modern browsers decided to implement it anyway. Only recently, the <code>__proto__</code> property has been standardized in the ECMAScript 2015 language specification for web browsers to ensure compatibility, so will be supported into the future. It is deprecated in favor of {{jsxref("Object.getPrototypeOf")}}/{{jsxref("Reflect.getPrototypeOf")}} and {{jsxref("Object.setPrototypeOf")}}/{{jsxref("Reflect.setPrototypeOf")}} (though still, setting the <code>[[Prototype]]</code> of an object is a slow operation that should be avoided if performance is a concern).</p>
+
+<p>The <code>__proto__</code> property can also be used in an object literal definition to set the object <code>[[Prototype]]</code> on creation, as an alternative to {{jsxref("Object.create()")}}. See: <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer / literal syntax</a>.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: js">var Circle = function () {};
+var shape = {};
+var circle = new Circle();
+
+// Set the object prototype.
+// DEPRECATED. This is for example purposes only. DO NOT DO THIS in real code.
+shape.__proto__ = circle;
+
+// Get the object prototype
+console.log(shape.__proto__ === circle); // true
+</pre>
+
+<pre class="brush: js">var shape = function () {};
+var p = {
+  a: function () {
+  console.log('aaa');
+  }
+};
+shape.prototype.__proto__ = p;
+
+var circle = new shape();
+circle.a(); // aaa
+console.log(shape.prototype === circle.__proto__); // true
+
+// or
+var shape = function () {};
+var p = {
+ a: function () {
+ console.log('a');
+ }
+};
+
+var circle = new shape();
+circle.__proto__ = p;
+circle.a(); // a
+console.log(shape.prototype === circle.__proto__); // false
+
+// or
+function test() {};
+test.prototype.myname = function () {
+ console.log('myname');
+};
+
+var a = new test();
+console.log(a.__proto__ === test.prototype); // true
+a.myname(); // myname
+
+
+// or
+var fn = function () {};
+fn.prototype.myname = function () {
+ console.log('myname');
+};
+
+var obj = {
+ __proto__: fn.prototype
+};
+
+obj.myname(); // myname
+</pre>
+
+<p>Note: that is two underscores, followed by the five characters "proto", followed by two more underscores.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>The <code>__proto__</code> getter function exposes the value of the internal <code>[[Prototype]]</code> of an object. For objects created using an object literal, this value is {{jsxref("Object.prototype")}}. For objects created using array literals, this value is {{jsxref("Array.prototype")}}. For functions, this value is {{jsxref("Function.prototype")}}. For objects created using <code>new fun</code>, where <code>fun</code> is one of the built-in constructor functions provided by JavaScript ({{jsxref("Array")}}, {{jsxref("Boolean")}}, {{jsxref("Date")}}, {{jsxref("Number")}}, {{jsxref("Object")}}, {{jsxref("String")}}, and so on — including new constructors added as JavaScript evolves), this value is always <code>fun.prototype</code>. For objects created using <code>new fun</code>, where <code>fun</code> is a function defined in a script, this value is the value of <code>fun.prototype</code>. (That is, if the constructor didn't return an other object explicitly, or the <code>fun.prototype</code> has been reassigned since the instance was created).</p>
+
+<p>The <code>__proto__</code> setter allows the <code>[[Prototype]]</code> of an object to be mutated. The object must be extensible according to {{jsxref("Object.isExtensible()")}}: if it is not, a {{jsxref("Global_Objects/TypeError", "TypeError")}} is thrown. The value provided must be an object or {{jsxref("Global_Objects/null", "null")}}. Providing any other value will do nothing.</p>
+
+<p>To understand how prototypes are used for inheritance, see guide article <a href="/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain">Inheritance and the prototype chain</a>.</p>
+
+<p>The <code>__proto__</code> property is a simple accessor property on {{jsxref("Object.prototype")}} consisting of a getter and setter function. A property access for <code>__proto__</code> that eventually consults {{jsxref("Object.prototype")}} will find this property, but an access that does not consult {{jsxref("Object.prototype")}} will not find it. If some other <code>__proto__</code> property is found before {{jsxref("Object.prototype")}} is consulted, that property will hide the one found on {{jsxref("Object.prototype")}}.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-additional-properties-of-the-object.prototype-object', 'Object.prototype.__proto__')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Included in the (normative) annex for additional ECMAScript legacy features for Web browsers (note that the specification codifies what is already in implementations).</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-additional-properties-of-the-object.prototype-object', 'Object.prototype.__proto__')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Object.proto")}}</p>
+</div>
+
+<h2 id="Compatibility_notes">Compatibility notes</h2>
+
+<p>While the ECMAScript 2015 specification dictates that support for <code>__proto__</code> is required <em>only</em> for web browsers (although being normative), other environments may support it as well for legacy usage.</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Object.prototype.isPrototypeOf()")}}</li>
+ <li>{{jsxref("Object.getPrototypeOf()")}}</li>
+ <li>{{jsxref("Object.setPrototypeOf()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html
new file mode 100644
index 0000000000..21c2a53985
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/prototype/index.html
@@ -0,0 +1,218 @@
+---
+title: Object.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Object/prototype
+tags:
+ - JavaScript
+ - Object
+ - 待翻譯
+translation_of: Web/JavaScript/Reference/Global_Objects/Object
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Object.prototype</strong></code> 代表 {{jsxref("Object")}} 的原型物件。</p>
+
+<div>{{js_property_attributes(0, 0, 0)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p>All objects in JavaScript are descended from {{jsxref("Object")}}; all objects inherit methods and properties from <code>Object.prototype</code>, although they may be overridden (except an <code>Object</code> with a <code>null</code> prototype, i.e. <code>Object.create(null)</code>). For example, other constructors' prototypes override the <code>constructor</code> property and provide their own {{jsxref("Object.prototype.toString()", "toString()")}} methods. Changes to the <code>Object</code> prototype object are propagated to all objects unless the properties and methods subject to those changes are overridden further along the prototype chain.</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("Object.prototype.constructor")}}</dt>
+ <dd>Specifies the function that creates an object's prototype.</dd>
+ <dt>{{jsxref("Object.prototype.__proto__")}} {{non-standard_inline}}</dt>
+ <dd>Points to the object which was used as prototype when the object was instantiated.</dd>
+ <dt>{{jsxref("Object.prototype.__noSuchMethod__")}} {{non-standard_inline}}</dt>
+ <dd>Allows a function to be defined that will be executed when an undefined object member is called as a method.</dd>
+ <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__count__")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">Used to return the number of enumerable properties directly on a user-defined object, but has been removed.</s></dd>
+ <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__parent__")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">Used to point to an object's context, but has been removed.</s></dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Object.prototype.__defineGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
+ <dd>Associates a function with a property that, when accessed, executes that function and returns its return value.</dd>
+ <dt>{{jsxref("Object.prototype.__defineSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
+ <dd>Associates a function with a property that, when set, executes that function which modifies the property.</dd>
+ <dt>{{jsxref("Object.prototype.__lookupGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
+ <dd>Returns the function associated with the specified property by the {{jsxref("Object.defineGetter", "__defineGetter__")}} method.</dd>
+ <dt>{{jsxref("Object.prototype.__lookupSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
+ <dd>Returns the function associated with the specified property by the {{jsxref("Object.defineSetter", "__defineSetter__")}} method.</dd>
+ <dt>{{jsxref("Object.prototype.hasOwnProperty()")}}</dt>
+ <dd>Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain.</dd>
+ <dt>{{jsxref("Object.prototype.isPrototypeOf()")}}</dt>
+ <dd>Returns a boolean indication whether the specified object is in the prototype chain of the object this method is called upon.</dd>
+ <dt>{{jsxref("Object.prototype.propertyIsEnumerable()")}}</dt>
+ <dd>Returns a boolean indicating if the internal <a href="/en-US/docs/ECMAScript_DontEnum_attribute" title="ECMAScript_DontEnum_attribute">ECMAScript DontEnum attribute</a> is set.</dd>
+ <dt>{{jsxref("Object.prototype.toSource()")}} {{non-standard_inline}}</dt>
+ <dd>Returns string containing the source of an object literal representing the object that this method is called upon; you can use this value to create a new object.</dd>
+ <dt>{{jsxref("Object.prototype.toLocaleString()")}}</dt>
+ <dd>Calls {{jsxref("Object.toString", "toString()")}}.</dd>
+ <dt>{{jsxref("Object.prototype.toString()")}}</dt>
+ <dd>Returns a string representation of the object.</dd>
+ <dt>{{jsxref("Object.prototype.unwatch()")}} {{non-standard_inline}}</dt>
+ <dd>Removes a watchpoint from a property of the object.</dd>
+ <dt>{{jsxref("Object.prototype.valueOf()")}}</dt>
+ <dd>Returns the primitive value of the specified object.</dd>
+ <dt>{{jsxref("Object.prototype.watch()")}} {{non-standard_inline}}</dt>
+ <dd>Adds a watchpoint to a property of the object.</dd>
+ <dt><s class="obsoleteElement">{{jsxref("Object.prototype.eval()")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">Used to evaluate a string of JavaScript code in the context of the specified object, but has been removed.</s></dd>
+</dl>
+
+<h2 id="範例">範例</h2>
+
+<p>因為 JavaScript 並沒有子類別的物件,所以原型是個很有用的解決辦法, 使某些函數作為物件的基本類別物件。例如:</p>
+
+<pre class="brush: js">var Person = function() {
+ this.canTalk = true;
+};
+
+Person.prototype.greet = function() {
+ if (this.canTalk) {
+ console.log('Hi, I am ' + this.name);
+ }
+};
+
+var Employee = function(name, title) {
+ Person.call(this);
+ this.name = name;
+ this.title = title;
+};
+
+Employee.prototype = Object.create(Person.prototype);
+Employee.prototype.constructor = Employee;
+
+Employee.prototype.greet = function() {
+ if (this.canTalk) {
+ console.log('Hi, I am ' + this.name + ', the ' + this.title);
+ }
+};
+
+var Customer = function(name) {
+ Person.call(this);
+ this.name = name;
+};
+
+Customer.prototype = Object.create(Person.prototype);
+Customer.prototype.constructor = Customer;
+
+var Mime = function(name) {
+ Person.call(this);
+ this.name = name;
+ this.canTalk = false;
+};
+
+Mime.prototype = Object.create(Person.prototype);
+Mime.prototype.constructor = Mime;
+
+var bob = new Employee('Bob', 'Builder');
+var joe = new Customer('Joe');
+var rg = new Employee('Red Green', 'Handyman');
+var mike = new Customer('Mike');
+var mime = new Mime('Mime');
+
+bob.greet();
+// Hi, I am Bob, the Builder
+
+joe.greet();
+// Hi, I am Joe
+
+rg.greet();
+// Hi, I am Red Green, the Handyman
+
+mike.greet();
+// Hi, I am Mike
+
+mime.greet();
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.1', 'Object.prototype')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.prototype', 'Object.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript">Introduction to Object-Oriented JavaScript</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/object/watch/index.html b/files/zh-tw/web/javascript/reference/global_objects/object/watch/index.html
new file mode 100644
index 0000000000..9dc8afa27f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/object/watch/index.html
@@ -0,0 +1,191 @@
+---
+title: Object.prototype.watch()
+slug: Web/JavaScript/Reference/Global_Objects/Object/watch
+translation_of: Archive/Web/JavaScript/Object.watch
+---
+<div>{{JSRef}}</div>
+
+<div class="warning">
+<p><strong>Warning:</strong> Generally you should avoid using <code>watch()</code> and {{jsxref("Object.prototype.unwatch", "unwatch()")}} when possible. These two methods are implemented only in Gecko, and they're intended primarily for debugging use. In addition, using watchpoints has a serious negative impact on performance, which is especially true when used on global objects, such as <code>window</code>. You can usually use <a href="/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">setters and getters</a> or proxies instead. See {{anch("Browser compatibility")}} for details. Also, do not confuse {{jsxref("Object.prototype.watch", "Object.watch")}} with {{jsxref("Object.prototype.observe", "Object.observe")}}.</p>
+</div>
+
+<p>The <code><strong>watch()</strong></code> method watches for a property to be assigned a value and runs a function when that occurs.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><var>obj</var>.watch(<var>prop</var>, <var>handler</var>)</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>prop</code></dt>
+ <dd>所需要監聽其值是否改變的物件屬性</dd>
+ <dt><code>handler</code></dt>
+ <dd>當監聽的變數其數值變換時所執行的function</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>{{jsxref("undefined")}}.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>Watches for assignment to a property named <code>prop</code> in this object, 呼叫 <code>handler(prop, oldval, newval)</code> whenever <code>prop</code> is set and storing the return value in that property. A watchpoint can filter (or nullify) the value assignment, by returning a modified <code>newval</code> (or by returning <code>oldval</code>).</p>
+
+<p>當你刪掉所監聽的物件屬性,並不會結束針對該物件屬性的監聽。當你重新產生該屬性時,監聽依舊維持作用。</p>
+
+<p>要停止該次監聽, 須使用 {{jsxref("Object.unwatch", "unwatch()")}} 函式. By default, the <code>watch</code> method is inherited by every object descended from {{jsxref("Object")}}.</p>
+
+<p>The JavaScript debugger has functionality similar to that provided by this method, as well as other debugging options. For information on the debugger, see <a href="/en-US/docs/Venkman">Venkman</a>.</p>
+
+<p>In Firefox, <code>handler</code> is only called from assignments in script, not from native code. For example, <code>window.watch('location', myHandler)</code> will not call <code>myHandler</code> if the user clicks a link to an anchor within the current document. However, <code>window.location += '#myAnchor'</code> will call <code>myHandler</code>.</p>
+
+<div class="note">
+<p><strong>Note:</strong> Calling <code>watch()</code> on an object for a specific property overrides any previous handler attached for that property.</p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用watch_和_unwatch">使用watch 和 unwatch</h3>
+
+<pre class="brush: js">var o = { p: 1 };
+
+o.watch('p', function (id, oldval, newval) {
+ console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval);
+ return newval;
+});
+
+o.p = 2;
+o.p = 3;
+delete o.p;
+o.p = 4;
+
+o.unwatch('p');
+o.p = 5;
+</pre>
+
+<p>上述程式執行結果:</p>
+
+<pre>o.p changed from 1 to 2
+o.p changed from 2 to 3
+o.p changed from undefined to 4
+</pre>
+
+<h3 id="使用_watch_驗證物件的屬性">使用 <code>watch</code> 驗證物件的屬性</h3>
+
+<p>You can use <code>watch</code> to test any assignment to an object's properties. This example ensures that every Person always has a valid name and an age between 0 and 200.</p>
+
+<pre class="brush: js">Person = function(name, age) {
+ this.watch('age', Person.prototype._isValidAssignment);
+ this.watch('name', Person.prototype._isValidAssignment);
+ this.name = name;
+ this.age = age;
+};
+
+Person.prototype.toString = function() {
+ return this.name + ', ' + this.age;
+};
+
+Person.prototype._isValidAssignment = function(id, oldval, newval) {
+ if (id === 'name' &amp;&amp; (!newval || newval.length &gt; 30)) {
+ throw new RangeError('invalid name for ' + this);
+ }
+ if (id === 'age' &amp;&amp; (newval &lt; 0 || newval &gt; 200)) {
+ throw new RangeError('invalid age for ' + this);
+ }
+ return newval;
+}
+
+will = new Person('Will', 29);
+console.log(will); // Will, 29
+
+try {
+ will.name = '';
+} catch (e) {
+ console.log(e);
+}
+
+try {
+ will.age = -4;
+} catch (e) {
+ console.log(e);
+}
+</pre>
+
+<p>上述程式執行結果:</p>
+
+<pre>Will, 29
+RangeError: invalid name for Will, 29
+RangeError: invalid age for Will, 29
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<p>Not part of any specifications. Implemented in JavaScript 1.2.</p>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Compatibility_notes">Compatibility notes</h2>
+
+<ul>
+ <li>This <a class="external link-https" href="https://gist.github.com/384583">Polyfill</a> offers <code>watch</code> to all ES5 compatible browsers.</li>
+ <li>Using a {{jsxref("Proxy")}} enables you do even deeper changes to how property assignments work.</li>
+ <li>Calling <code>watch()</code> on the {{domxref("Document")}} object throws a {{jsxref("TypeError")}} since Firefox 23 ({{bug(903332)}}). This regression has been fixed with Firefox 27.</li>
+</ul>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li>{{jsxref("Object.unwatch()")}}</li>
+ <li>{{jsxref("Object.observe()")}} {{obsolete_inline}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/parseint/index.html b/files/zh-tw/web/javascript/reference/global_objects/parseint/index.html
new file mode 100644
index 0000000000..ee365f3ce3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/parseint/index.html
@@ -0,0 +1,193 @@
+---
+title: parseInt()
+slug: Web/JavaScript/Reference/Global_Objects/parseInt
+tags:
+ - Global method
+ - parseInt
+ - 整數
+ - 進位制
+translation_of: Web/JavaScript/Reference/Global_Objects/parseInt
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p><code><strong>parseInt()</strong></code> 函式能將輸入的字串轉成整數。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/globalprops-parseint.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">parseInt(<em>string</em>, <em>radix</em>);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>string</code></dt>
+ <dd>待轉成數字的字串。若 <code>string</code> 參數類型不是字串的話,會先將其轉成字串(相當於先執行 <code><a href="http://www.ecma-international.org/ecma-262/6.0/#sec-tostring">ToString</a></code> 再執行 <code>parseInt</code>)空白值會被忽略。</dd>
+ <dt><code>radix</code></dt>
+ <dd>從 2 到 36,能代表該進位系統的數字。例如說指定 <code>10</code> 就等於指定十進位。<strong>一定要定義這個參數</strong>以避免他人的困惑、也好預估函式的行為。如果沒有指定 radix 的話,給出的結果會按照實做不同而異,請注意,通常預設值<strong>不是</strong> 10 進位。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>藉由給定字串作轉換後的數字。若第一個字符無法轉換為數字,則回傳 {{jsxref("NaN")}}。</p>
+
+<h2 id="說明">說明</h2>
+
+<p><code>parseInt</code> 函式會把第一個參數變成字串、解析它、再回傳整數或是 <code>NaN</code>。如果不是 <code>NaN</code>,回傳值會把第一個參數,參照指定的 <var>radix</var> 後,以十進位表示。例如,<var>radix</var> 指定為 10 的話,它會以十進位為單位轉換、8 是八進位、16 是十六進位,依此類推。For radices above <code>10</code>, the letters of the alphabet indicate numerals greater than <code>9</code>. For example, for hexadecimal numbers (base 16), <code>A</code> through <code>F</code> are used.</p>
+
+<p>如果說 <code>parseInt</code> 碰上了無法被 radix 指定的進位制所轉換的字元,它會忽略該字元、以及其後所有字元,並只回傳至該位置為止的解析數值結果。<code>parseInt</code> 將數字擷取、轉換成整數數值。 可以接受字串首尾出現空白。</p>
+
+<p>Because some numbers include the <code>e</code> character in their string representation (e.g. <strong><code>6.022e23</code></strong>), using <code>parseInt</code> to truncate numeric values will produce unexpected results when used on very large or very small numbers. <code>parseInt</code> should not be used as a substitute for {{jsxref("Math.floor()")}}.</p>
+
+<p>如果 <var>radix</var> 是 <code>undefined</code> 或 0(或留空)的話,JavaScript 會:</p>
+
+<ul>
+ <li>如果 <code>string</code> 由 "0x" 或 "0X" 開始,<var>radix</var> 會變成代表十六進位的 16,並解析字串的餘數。</li>
+ <li>如果 <code>string</code> 由 0 開始,則 <var>radix</var> 會變成代表八進位的 8 或十進位的 10,但到底會變成 8 還是 10 則取決於各實做。ECMAScript 規定用代表十進位的 10,但也不是所有瀏覽器都支持。因此,<strong>使用 <code>parseInt</code> 時一定要指定 radix</strong>。</li>
+ <li>如果 <code>string</code> 由其他字串開始,radix 就會是十進位的 10。</li>
+</ul>
+
+<p>如果第一個字串無法被解析為任何數字,<code>parseInt</code> 會回傳 <code>NaN</code>。</p>
+
+<p>For arithmetic purposes, the <code>NaN</code> value is not a number in any radix. You can call the {{jsxref("isNaN")}} function to determine if the result of <code>parseInt</code> is <code>NaN</code>. If <code>NaN</code> is passed on to arithmetic operations, the operation results will also be <code>NaN</code>.</p>
+
+<p>若想將數字轉成特定的進位制,可使用 <code>intValue.toString(radix)</code>。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_parseInt">使用 <code>parseInt</code></h3>
+
+<p>以下的範例,回傳的值均為 <strong><code>15</code></strong>:</p>
+
+<pre class="brush: js">parseInt(" 0xF", 16);
+parseInt(" F", 16);
+parseInt("17", 8);
+parseInt(021, 8);
+parseInt("015", 10); // parseInt(015, 10); will return 15
+parseInt(15.99, 10);
+parseInt("15,123", 10);
+parseInt("FXX123", 16);
+parseInt("1111", 2);
+parseInt("15*3", 10);
+parseInt("15e2", 10);
+parseInt("15px", 10);
+parseInt("12", 13);
+</pre>
+
+<p>以下均回傳 <strong><code>NaN</code></strong>:</p>
+
+<pre class="brush: js">parseInt("Hello", 8); // 根本不是數字
+parseInt("546", 2); // 在二進位無效
+</pre>
+
+<p>以下的範例,回傳的值均為 <strong><code>-15</code></strong>:</p>
+
+<pre class="brush: js">parseInt("-F", 16);
+parseInt("-0F", 16);
+parseInt("-0XF", 16);
+parseInt(-15.1, 10)
+parseInt(" -17", 8);
+parseInt(" -15", 10);
+parseInt("-1111", 2);
+parseInt("-15e1", 10);
+parseInt("-12", 13);
+</pre>
+
+<p>下例會回傳 <strong><code>4</code></strong>:</p>
+
+<pre class="brush: js">parseInt(4.7, 10);
+parseInt(4.7 * 1e22, 10); // Very large number becomes 4
+parseInt(0.00000000000434, 10); // Very small number becomes 4
+</pre>
+
+<p>下例會回傳 <strong><code>224</code></strong>:</p>
+
+<pre class="brush: js">parseInt("0e0", 16);
+</pre>
+
+<h2 id="無_radix_情況下的八進制">無 radix 情況下的八進制</h2>
+
+<p>雖說已在 ECMAScript 3 提議並於 ECMAScript 5 禁用,但部分 javascript 編譯器仍會在特殊情況下,將 str 視作八進位數字(當數字以 <code>0</code> 開頭時)。以下為可能發生這種問題的情況:(<strong>永遠要宣告 radix 以避開這不可靠的行為</strong>)</p>
+
+<pre class="brush: js">parseInt("0e0"); // 0
+parseInt("08"); // 0, '8' is not an octal digit.
+</pre>
+
+<h3 id="ECMAScript_5_移除八進位轉譯(octal_interpretation)">ECMAScript 5 移除八進位轉譯(octal interpretation)</h3>
+
+<p>The ECMAScript 5 specification of the function <code>parseInt</code> no longer allows implementations to treat Strings beginning with a <code>0</code> character as octal values. ECMAScript 5 states:</p>
+
+<p>The <code>parseInt</code> function produces an integer value dictated by interpretation of the contents of the string argument according to the specified radix. Leading white space in string is ignored. If radix is undefined or <code>0</code>, it is assumed to be <code>10</code> except when the number begins with the character pairs <code>0x</code> or <code>0X</code>, in which case a radix of 16 is assumed.</p>
+
+<p>This differs from ECMAScript 3, which discouraged but allowed octal interpretation.</p>
+
+<p>Many implementations have not adopted this behavior as of 2013, and because older browsers must be supported, <strong>always specify a radix</strong>.</p>
+
+<h2 id="嚴謹的解析_function">嚴謹的解析 function</h2>
+
+<p>有的時候,使用更嚴謹的 code 能夠更精確地轉換整數值。 Regular expressions 可以幫你:</p>
+
+<pre class="brush: js">filterInt = function (value) {
+ if(/^(\-|\+)?([0-9]+|Infinity)$/.test(value))
+ return Number(value);
+ return NaN;
+}
+
+console.log(filterInt('421')); // 421
+console.log(filterInt('-421')); // -421
+console.log(filterInt('+421')); // 421
+console.log(filterInt('Infinity')); // Infinity
+console.log(filterInt('421e+0')); // NaN
+console.log(filterInt('421hop')); // NaN
+console.log(filterInt('hop1.61803398875')); // NaN
+console.log(filterInt('1.61803398875')); // NaN
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.1.2.2', 'parseInt')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-parseint-string-radix', 'parseInt')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-parseint-string-radix', 'parseInt')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.parseInt")}}</p>
+
+<h2 id="延伸閱讀">延伸閱讀</h2>
+
+<ul>
+ <li>{{jsxref("Global_Objects/parseFloat", "parseFloat()")}}</li>
+ <li>{{jsxref("Number.parseFloat()")}}</li>
+ <li>{{jsxref("Number.parseInt()")}}</li>
+ <li>{{jsxref("Global_Objects/isNaN", "isNaN()")}}</li>
+ <li>{{jsxref("Number.toString()")}}</li>
+ <li>{{jsxref("Object.valueOf")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/all/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/all/index.html
new file mode 100644
index 0000000000..eb18ce63f9
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/all/index.html
@@ -0,0 +1,207 @@
+---
+title: Promise.all()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/all
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/all
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Promise.all()</strong></code> 方法回傳一個 {{jsxref("Promise")}} 物件,當引數 <code>iterable</code> 中所有的 promises 都被實現(resolved),或引數 iterable 不含任何 promise 時,被實現。或以第一個被拒絕的 promise 的原因被拒絕。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>Promise.all(iterable)</var>;</pre>
+
+<dl>
+ <dt>iterable</dt>
+ <dd>一個 <a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol">iterable</a> 物件像是 {{jsxref("Array")}} 或 {{jsxref("String")}}。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<ul>
+ <li>一個<strong>已被實現(already resolved)</strong>的 {{jsxref("Promise")}},若傳入的 iterable 為空。</li>
+ <li>一個<strong>非同步地被實現(asynchronously resolved)</strong>的 {{jsxref("Promise")}} 若傳入的 iterable 不含 promise。注意,Google Chrome 58 對此情形回傳一個<strong>已被解決</strong>的 promise。</li>
+ <li>一個<strong>擱置(pending)</strong>的 {{jsxref("Promise")}},對所有剩餘情形。此 promise 接著被<strong>非同步地</strong>被 resolved/rejected(只要堆疊為空)當 iterable 中所有的 promises 都被實現,或其中一個被拒絕。參見下方關於"Promise.all 的非同步與同步性質"的例子。</li>
+</ul>
+
+<h2 id="描述">描述</h2>
+
+<p>此方法在聚集(aggregating)多個 promises 的結果時很有幫助。</p>
+
+<p>實現(Fulfillment):<br>
+ 若傳入空的 iterable,此方法(同步地)回傳一個已被解決的 promise。若所有傳入的 promises 都被實現,或都不是 promise,<code>Promise.all</code> 回傳的 promise 被非同步地實現。無論是哪個情形,回傳一個以 iterable 其內<strong>所有</strong>值(包含非 promise 值)作為引數的陣列被實現。<br>
+  </p>
+
+<p>拒絕(Rejection):<br>
+ 若任一個傳入的 promise 被拒絕,Promise.all 非同步地以其值被拒絕,無論其他 promises 是否被解決。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Promise.all">使用 <code>Promise.all</code></h3>
+
+<p><code>Promise.all</code> 等到全部實現(或一個拒絕)。</p>
+
+<pre class="brush: js">var p1 = Promise.resolve(3);
+var p2 = 1337;
+var p3 = new Promise((resolve, reject) =&gt; {
+ setTimeout(resolve, 100, 'foo');
+});
+
+Promise.all([p1, p2, p3]).then(values =&gt; {
+ console.log(values); // [3, 1337, "foo"]
+});</pre>
+
+<p>若 iterable 含非 promise 值,它們將被忽略,但依然會被記入回傳 promise 陣列值(若被實現):</p>
+
+<pre class="brush: js">// this will be counted as if the iterable passed is empty, so it gets fulfilled
+var p = Promise.all([1,2,3]);
+// this will be counted as if the iterable passed contains only the resolved promise with value "444", so it gets fulfilled
+var p2 = Promise.all([1,2,3, Promise.resolve(444)]);
+// this will be counted as if the iterable passed contains only the rejected promise with value "555", so it gets rejected
+var p3 = Promise.all([1,2,3, Promise.reject(555)]);
+
+// using setTimeout we can execute code after the stack is empty
+setTimeout(function(){
+ console.log(p);
+ console.log(p2);
+ console.log(p3);
+});
+
+// logs
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: Array[3] }
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: Array[4] }
+// Promise { &lt;state&gt;: "rejected", &lt;reason&gt;: 555 }</pre>
+
+<h3 id="Promise.all_的非同步與同步性質"><code>Promise.all</code> 的非同步與同步性質</h3>
+
+<p>以下例子驗證了 <code>Promise.all</code> 的非同步性質(asynchronicity)(或同步性質(synchronicity),若傳入的 iterable 是空的):</p>
+
+<pre class="brush: js">// we are passing as argument an array of promises that are already resolved,
+// to trigger Promise.all as soon as possible
+var resolvedPromisesArray = [Promise.resolve(33), Promise.resolve(44)];
+
+var p = Promise.all(resolvedPromisesArray);
+// immediately logging the value of p
+console.log(p);
+
+// using setTimeout we can execute code after the stack is empty
+setTimeout(function(){
+ console.log('the stack is now empty');
+ console.log(p);
+});
+
+// logs, in order:
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: Array[2] }
+</pre>
+
+<p><code>當</code> <code>Promise.all</code> 被拒絕時發生一樣的事情:</p>
+
+<pre class="brush: js">var mixedPromisesArray = [Promise.resolve(33), Promise.reject(44)];
+var p = Promise.all(mixedPromisesArray);
+console.log(p);
+setTimeout(function(){
+ console.log('the stack is now empty');
+ console.log(p);
+});
+
+// logs
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "rejected", &lt;reason&gt;: 44 }
+</pre>
+
+<p>注意!<code>Promise.all</code> 同步地被解決<strong>若且唯若</strong>傳入的 iterable 為空:</p>
+
+<pre class="brush: js">var p = Promise.all([]); // will be immediately resolved
+var p2 = Promise.all([1337, "hi"]); // non-promise values will be ignored, but the evaluation will be done asynchronously
+console.log(p);
+console.log(p2)
+setTimeout(function(){
+ console.log('the stack is now empty');
+ console.log(p2);
+});
+
+// logs
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: Array[0] }
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: Array[2] }
+</pre>
+
+<h3 id="Promise.all_的失敗優先(fail-fast)行為"><code>Promise.all</code> 的失敗優先(fail-fast)行為</h3>
+
+<p><code>當任一個陣列成員被拒絕則</code> <code>Promise.all</code> 被拒絕。例如,若傳入四個將在一段時間後被解決的 promises,而其中一個立刻被拒絕,則 <code>Promise.all</code> 將立刻被拒絕。</p>
+
+<pre class="brush: js">var p1 = new Promise((resolve, reject) =&gt; {
+ setTimeout(resolve, 1000, 'one');
+});
+var p2 = new Promise((resolve, reject) =&gt; {
+ setTimeout(resolve, 2000, 'two');
+});
+var p3 = new Promise((resolve, reject) =&gt; {
+ setTimeout(resolve, 3000, 'three');
+});
+var p4 = new Promise((resolve, reject) =&gt; {
+ setTimeout(resolve, 4000, 'four');
+});
+var p5 = new Promise((resolve, reject) =&gt; {
+ reject('reject');
+});
+
+Promise.all([p1, p2, p3, p4, p5]).then(values =&gt; {
+ console.log(values);
+}, reason =&gt; {
+ console.log(reason)
+});
+
+//From console:
+//"reject"
+
+//You can also use .catch
+Promise.all([p1, p2, p3, p4, p5]).then(values =&gt; {
+ console.log(values);
+}).catch(reason =&gt; {
+ console.log(reason)
+});
+
+//From console:
+//"reject"
+
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.all', 'Promise.all')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.all', 'Promise.all')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise.all")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Promise.race()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/catch/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/catch/index.html
new file mode 100644
index 0000000000..d06036c11e
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/catch/index.html
@@ -0,0 +1,189 @@
+---
+title: Promise.prototype.catch()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/catch
+tags:
+ - EMCAScript 2015
+ - JavaScript
+ - Method
+ - Promise
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/catch
+---
+<div>{{JSRef}}</div>
+
+<p><strong>catch()</strong> 方法只處理 Promise 的被拒絕狀態,並回傳一個新的 <code>Promise</code> 物件。此方法的行為等同於呼叫 {{jsxref("Promise.then", "Promise.prototype.then(undefined, onRejected)")}}。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>p.catch(onRejected)</var>;
+
+p.catch(function(reason) {
+ // rejection
+});
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>onRejected</dt>
+ <dd>一個 {{jsxref("Function")}} ,在 <code>Promise</code> 被拒絕時被呼叫。這個函式有一個引數:
+ <dl>
+ <dt><code>reason</code></dt>
+ <dd>失敗訊息。</dd>
+ </dl>
+ 若 onRejected 拋出一個錯誤或回傳一個被拒絕的 Promise,則 catch() 回傳的 Promise 被拒絕;其他情形都是被實現。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>呼叫(<code>catch</code> 的 promise)物件,內部呼叫 <code>Promise.prototype.then</code>,傳入引數 undefined 及 onRejected;接著以之結果回傳(結果為 {{jsxref("Promise")}})。</p>
+
+<p><strong>內部呼叫演示:</strong></p>
+
+<pre class="brush: js">// overriding original Promise.prototype.then/catch just to add some logs
+(function(Promise){
+    var originalThen = Promise.prototype.then;
+    var originalCatch = Promise.prototype.catch;
+
+    Promise.prototype.then = function(){
+        console.log('&gt; &gt; &gt; &gt; &gt; &gt; called .then on %o with arguments: %o', this, arguments);
+        return originalThen.apply(this, arguments);
+    };
+    Promise.prototype.catch = function(){
+        console.log('&gt; &gt; &gt; &gt; &gt; &gt; called .catch on %o with arguments: %o', this, arguments);
+        return originalCatch.apply(this, arguments);
+    };
+
+})(this.Promise);
+
+
+
+// calling catch on an already resolved promise
+Promise.resolve().catch(function XXX(){});
+
+// logs:
+// &gt; &gt; &gt; &gt; &gt; &gt; called .catch on Promise{} with arguments: Arguments{1} [0: function XXX()]
+// &gt; &gt; &gt; &gt; &gt; &gt; called .then on Promise{} with arguments: Arguments{2} [0: undefined, 1: function XXX()]
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p><code>catch</code> 方法在處理 promise 組合的錯誤時很有幫助。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用及串接_catch_方法">使用及串接 <code>catch</code> 方法</h3>
+
+<pre class="brush: js">var p1 = new Promise(function(resolve, reject) {
+  resolve('Success');
+});
+
+p1.then(function(value) {
+  console.log(value); // "Success!"
+  throw 'oh, no!';
+}).catch(function(e) {
+  console.log(e); // "oh, no!"
+}).then(function(){
+  console.log('after a catch the chain is restored');
+}, function () {
+  console.log('Not fired due to the catch');
+});
+
+// The following behaves the same as above
+p1.then(function(value) {
+  console.log(value); // "Success!"
+ return Promise.reject('oh, no!');
+}).catch(function(e) {
+  console.log(e); // "oh, no!"
+}).then(function(){
+  console.log('after a catch the chain is restored');
+}, function () {
+  console.log('Not fired due to the catch');
+});
+</pre>
+
+<h3 id="拋出例外時的陷阱">拋出例外時的陷阱</h3>
+
+<pre class="brush: js">// Throwing an error will call the catch method most of the time
+var p1 = new Promise(function(resolve, reject) {
+  throw 'Uh-oh!';
+});
+
+p1.catch(function(e) {
+  console.log(e); // "Uh-oh!"
+});
+
+// Errors thrown inside asynchronous functions will act like uncaught errors
+var p2 = new Promise(function(resolve, reject) {
+  setTimeout(function() {
+  throw 'Uncaught Exception!';
+  }, 1000);
+});
+
+p2.catch(function(e) {
+  console.log(e); // This is never called
+});
+
+// Errors thrown after resolve is called will be silenced
+var p3 = new Promise(function(resolve, reject) {
+ resolve();
+  throw 'Silenced Exception!';
+});
+
+p3.catch(function(e) {
+   console.log(e); // This is never called
+});</pre>
+
+<h3 id="如果_Promise_被實現">如果 Promise 被實現</h3>
+
+<pre class="brush: js">//Create a promise which would not call onReject
+var p1 = Promise.resolve("calling next");
+
+var p2 = p1.catch(function (reason) {
+    //This is never called
+    console.log("catch p1!");
+    console.log(reason);
+});
+
+p2.then(function (value) {
+    console.log("next promise's onFulfilled"); /* next promise's onFulfilled */
+    console.log(value); /* calling next */
+}, function (reason) {
+    console.log("next promise's onRejected");
+    console.log(reason);
+});</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.prototype.catch', 'Promise.prototype.catch')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.prototype.catch', 'Promise.prototype.catch')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise.catch")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Promise.prototype.then()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html
new file mode 100644
index 0000000000..eef15faf9a
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/finally/index.html
@@ -0,0 +1,102 @@
+---
+title: Promise.prototype.finally()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/finally
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/finally
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>finally()</strong></code> 方法會回傳一個 {{jsxref("Promise")}}。當 promise 被 settled 後,無論其結果是 fulfilled 還是 rejected ,都會執行指定的回呼函數。它提供了一個讓 <code>Promise</code> 在被確認後,無論是 fulfilled 或是 rejected 都會執行某些程式碼的一種手段。</p>
+
+<p>這樣可以避免你在 promise 的 {{jsxref("Promise.then", "then()")}} 和 {{jsxref("Promise.catch", "catch()")}} 重複處理相同的程式碼。</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><var>p.finally(onFinally)</var>;
+
+p.finally(function() {
+ // settled(fulfilled 或 rejected)
+});
+</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>onFinally</code></dt>
+ <dd>當 <code>Promise</code> settled 後呼叫的 {{jsxref("Function")}}。</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>回傳 {{jsxref("Promise")}} 當 <code>finally</code> 的處理函數 <code>onFinally</code> 被指定時。</p>
+
+<h2 id="Description">Description</h2>
+
+<p>當你希望在 promise settled 後且不關心它的結果為何時,執行一些處理或清理的工作, <code>finally()</code> 方法會很有幫助。</p>
+
+<p><code>finally()</code> 方法非常類似於 <code>.then(onFinally, onFinally)</code> 的呼叫方式,但仍有一些差異:</p>
+
+<ul>
+ <li><font><font>當建立行內的函數時,可以只傳遞一次,從而避免重複宣告或為它宣告變數。</font></font></li>
+ <li><code>finally</code> 的回呼函數並不會接收到任何引數,因其沒有可靠的方式來確認 promise 是被 fulfilled 還是 rejected 。它的使用情境僅適用於當你<em>不關心</em> rejection 的原因或 fulfillment 的值,因此無須提供。範例:
+ <ul>
+ <li><font><font>與 </font></font><code>Promise.resolve(2).then(() =&gt; {}, () =&gt; {})</code><font><font>(將被 resolved 為</font></font><code>undefined</code><font><font>)不同,</font></font><code>Promise.resolve(2).finally(() =&gt; {})</code><font><font> 將被 resolved 為</font></font><code>2</code><font><font>。</font></font></li>
+ <li><font><font>同樣的,與 </font></font><code>Promise.reject(3).then(() =&gt; {}, () =&gt; {})</code><font><font>(將 fulfilled 為</font></font><code>undefined</code><font><font>)不同,</font></font><code>Promise.reject(3).finally(() =&gt; {})</code><font><font> 將被 rejected 為</font></font><code>3</code><font><font>。</font></font></li>
+ </ul>
+ </li>
+</ul>
+
+<div class="note">
+<p><strong>備註: </strong>在 finally 回呼中使用 throw (或回傳 rejected promise)會導致新的 promise 被 reject , reject 的原因則是呼叫 throw() 時所指定的值。</p>
+</div>
+
+<h2 id="Examples">Examples</h2>
+
+<pre class="brush: js">let isLoading = true;
+
+fetch(myRequest).then(function(response) {
+ var contentType = response.headers.get("content-type");
+ if(contentType &amp;&amp; contentType.includes("application/json")) {
+ return response.json();
+ }
+ throw new TypeError("Oops, we haven't got JSON!");
+ })
+ .then(function(json) { /* process your JSON further */ })
+ .catch(function(error) { console.log(error); })
+ .finally(function() { isLoading = false; });
+
+</pre>
+
+<div class="hidden">
+<p>Please do not add polyfills on MDN pages. For more details, refer to: <a href="https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500">https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500</a></p>
+</div>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.prototype.finally', 'Promise.prototype.finally')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise.finally")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Promise.prototype.then()")}}</li>
+ <li>{{jsxref("Promise.prototype.catch()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/index.html
new file mode 100644
index 0000000000..8ec1456ae1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/index.html
@@ -0,0 +1,256 @@
+---
+title: Promise
+slug: Web/JavaScript/Reference/Global_Objects/Promise
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Promise</code></strong> 物件代表一個即將完成、或失敗的非同步操作,以及它所產生的值。</p>
+
+<div class="note">
+<p>此條目為介紹 Promise 建構式。要瞭解 Promise 相關使用方式,請先參考<a href="/zh-TW/docs/Web/JavaScript/Guide/Using_promises">使用 Promise</a>。Promise 建構式主要用於包裹尚未支援 Promise 的函式。</p>
+</div>
+
+<div>{{EmbedInteractiveExample("pages/js/promise-constructor.html")}}</div>
+
+
+
+<p class="hidden">The source for this interactive demo is stored in a GitHub repository. If you'd like to contribute to the interactive demo project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">new Promise( /* executor */ function(resolve, reject) { ... } );</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>executor</dt>
+ <dd>為一個依序接收兩個參數的函式:<code>resolve</code> 及 <code>reject</code>(實現及拒絕回呼函式)。在 Promise 實作中,<code>executor</code> 函式在傳入參數 <code>resolve</code> 與 <code>reject</code> 後會立刻執行(<code>executor</code> 函式會在 <code>Promise</code> 建構式回傳 Promise 物件前被執行)。<code>resolve</code> 與 <code>reject</code> 函式,會在被個別呼叫時,個別執行之。通常 executor 函式會發起一些非同步操作。接著,成功完成後執行 <code>resolve</code> 以完成 promise;或如果有錯誤,執行 <code>rejects</code>。<br>如果 executor 函式在執行中拋出錯誤,promise 會被拒絕(rejected),回傳值也將被忽略。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p><code><strong>Promise</strong></code> 會代理一個建立時,不用預先得知的值。它使你能夠繫結(associate)著發動非同步操作後,最終的成功值(success value)或失敗訊息(failure reason)的處理函式(handlers)。這讓非同步方法回傳值的方式很像同步方法,但不是回傳最終結果:非同步方法回傳一個 <em>promise</em> 物件作為未來某時間點的值。</p>
+
+<p>一個 <code>Promise</code> 物件處於以下幾種狀態:</p>
+
+<ul>
+ <li><em>擱置(pending)</em>:初始狀態,不是 fulfilled 與 rejected。</li>
+ <li><em>實現(fulfilled)</em>:表示操作成功地完成。</li>
+ <li><em>拒絕(rejected)</em>:表示操作失敗了。</li>
+</ul>
+
+<p>一個處於擱置狀態的 promise 能以一個值被實現(fulfilled),或是以一個原因或錯誤而被拒絕(rejected)。當上述任一狀態轉換發生時,那些透過 <code>then</code> 方法所繫結(associated)的處理函式列隊就會依序被調用。(若一個 promise 已被實現或拒絕,繫結(attached)於它的處理函式將立即被呼叫,因此完成非同步操作與繫結處理函式之間不存在競爭條件(race condition)。)</p>
+
+<p>由於 <code>{{jsxref("Promise.then", "Promise.prototype.then()")}}</code> 以及 <code>{{jsxref("Promise.catch", "Promise.prototype.catch()")}}</code> 方法都回傳 promise,它們可以被串接。</p>
+
+<p><img alt="" src="https://cdn.rawgit.com/Vectaio/a76330b025baf9bcdf07cb46e5a9ef9e/raw/26c4213a93dee1c39611dcd0ec12625811b20a26/js-promise.svg"></p>
+
+<div class="note">
+<p><strong>容易混淆:</strong> 許多其他語言擁有機制用來惰性求值(lazy evaluation)及延遲(deferring)運算,它們也被稱作“promises” — e.g. Scheme. 然而在 JavaScript 中 Promises 代表那些(已經)發生中(happening)的程序,它們可以繫結回呼函式。若您要找的是惰性求值表示式,考慮不帶參數的 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function</a>:<code>f = () =&gt; <em>expression</em></code> 來建立惰性求值表示式,並透過 <code>f()</code> 進行求值.</p>
+</div>
+
+<div class="note">
+<p><strong>Note</strong>: 一個被實現或拒絕,但不處於 pending 的 promise 被稱作被解決(settled)。您也會見到使用解決(resolved)一詞來描述 promises — 這代表 promises 被實現(fulfilled)了。<a href="https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md">States and fates</a> 這篇文章包含了更多 promises 的專有名詞。</p>
+</div>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Promise.length</code></dt>
+ <dd>長度屬性,值固定為 <code>1</code>。(建構式參數數目).</dd>
+ <dt>{{jsxref("Promise.prototype")}}</dt>
+ <dd><code>Promise</code> 建構式的原型(prototype).</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Promise.all", "Promise.all(iterable)")}}</dt>
+ <dd>回傳一個 promise,當在引數 iterable 中所有 promises 都被實現時被實現,或在引數 iterable 中有一個 promise 被拒絕時立刻被拒絕。若回傳的 promise 被實現,它將以一個實現值的陣列被實現,其順序與 iterable 中的 promises 相同。若回傳的 promise 被拒絕,它將以失敗訊息被拒絕,此訊息來自第一個在 iterable 中被拒絕的 promise。這個方法在聚集許多 promises 的結果時很有效。</dd>
+ <dt>{{jsxref("Promise.race", "Promise.race(iterable)")}}</dt>
+ <dd>回傳一個被實現或拒絕的 promise,當 iterable 中有一個 promise 被實現或拒絕時。</dd>
+</dl>
+
+<dl>
+ <dt>{{jsxref("Promise.reject", "Promise.reject(reason)")}}</dt>
+ <dd>回傳一個以失敗訊息拒絕的 <code>promise</code>。</dd>
+</dl>
+
+<dl>
+ <dt>{{jsxref("Promise.resolve", "Promise.resolve(value)")}}</dt>
+ <dd>回傳一個以 value 實現的 <code>promise</code>。若該值為 thenable (i.e. 具有 <code>then</code> 方法),回傳的 promise 將跟隨(follow)之,採用她的最終狀態; 在其他情形回傳的 promise 將以 value 被實現。一般來說,當您不知道 value 是否為 promise,使用 {{jsxref("Promise.resolve", "Promise.resolve(value)")}},將回傳值以 promise 作處理。</dd>
+</dl>
+
+<h2 id="Promise_原型"><code>Promise</code> 原型</h2>
+
+<h3 id="屬性_2">屬性</h3>
+
+<p>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Promise/prototype','屬性')}}</p>
+
+<h3 id="方法_2">方法</h3>
+
+<p>{{page('zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Promise/prototype','方法')}}</p>
+
+<h2 id="建立_Promise">建立 Promise</h2>
+
+<p><code><font face="Open Sans, arial, x-locale-body, sans-serif">一個</font></code> <code>Promise</code> 物件透過 <code>new</code> 及其建構式建立。這個建構式接收一個叫作”執行器函式(executor function)“的引數。此函式接收兩個函式作為引數。第一個函式(<code>resolve)</code>在非同步作業成功完成時,以該作業之結果值被呼叫。第二個函式(<code>reject</code>)在作業失敗時,以失敗訊息,通常是一個 error object,被呼叫。</p>
+
+<pre class="brush: js">const myFirstPromise = new Promise((resolve, reject) =&gt; {
+ // 執行一些非同步作業,最終呼叫:
+ //
+ // resolve(someValue); // 實現
+ // 或
+ // reject("failure reason"); // 拒絕
+});
+</pre>
+
+<p>要提供一個函式 promise 功能,讓它回傳一個 promise 即可:</p>
+
+<pre class="brush: js">function myAsyncFunction(url) {
+ return new Promise((resolve, reject) =&gt; {
+ const xhr = new XMLHttpRequest();
+ xhr.open("GET", url);
+ xhr.onload = () =&gt; resolve(xhr.responseText);
+ xhr.onerror = () =&gt; reject(xhr.statusText);
+ xhr.send();
+ });
+};</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="入門範例">入門範例</h3>
+
+<pre class="brush: js">let myFirstPromise = new Promise((resolve, reject) =&gt; {
+ // 當非同步作業成功時,呼叫 resolve(...),而失敗時則呼叫 reject(...)。
+ // 在這個例子中,使用 setTimeout(...) 來模擬非同步程式碼。
+ // 在實務中,您將可能使用像是 XHR 或者一個 HTML5 API.
+ setTimeout(function(){
+ resolve("Success!"); // Yay!非常順利!
+ }, 250);
+});
+
+myFirstPromise.then((successMessage) =&gt; {
+ // successMessage 是任何您由上方 resolve(...) 傳入的東西。
+ // 在此僅作為成功訊息,但是它不一定是字串。
+ console.log("Yay! " + successMessage);
+});
+</pre>
+
+<h3 id="進階範例">進階範例</h3>
+
+<pre class="brush: html hidden">&lt;button id="btn"&gt;Make a promise!&lt;/button&gt;
+&lt;div id="log"&gt;&lt;/div&gt;
+</pre>
+
+<p><code>這個小範例演示了</code> <code>Promise</code> <code>的運作機制。每當 </code>{{HTMLElement("button")}} 被點擊時,<code>testPromise()</code> 方法被呼叫。每次點擊將透過 {{domxref("window.setTimeout()")}} 建立一個將在 1-3 秒內隨機地被實現的 promise,供 promise 計數(一個從 1 開始的數值)。建構式 <code>Promise()</code> 被用來建立 promise。</p>
+
+<p>promise 的實現值單純地經由一個實現回呼函式 {{jsxref("Promise.prototype.then()","p1.then()")}} 被印出。下以一些文字紀錄來展現方法中同步的與非同步處理 promise 的部分是如何分離彼此。</p>
+
+<pre class="brush: js">'use strict';
+var promiseCount = 0;
+
+function testPromise() {
+ let thisPromiseCount = ++promiseCount;
+
+ let log = document.getElementById('log');
+ log.insertAdjacentHTML('beforeend', thisPromiseCount +
+ ') Started (&lt;small&gt;Sync code started&lt;/small&gt;)&lt;br/&gt;');
+
+ // 建立一個新的 promise:此 promise 承諾一個數值計數, 由 1 開始(等待約 2 秒)
+ let p1 = new Promise(
+ // 這個解決器函數(resolver function)呼叫實現或
+ // 拒絕 promise。
+ (resolve, reject) =&gt; {
+ log.insertAdjacentHTML('beforeend', thisPromiseCount +
+ ') Promise started (&lt;small&gt;Async code started&lt;/small&gt;)&lt;br/&gt;');
+ // 在此例子單純用來產生非同步特性。
+ window.setTimeout(
+ function() {
+ // 實現這個 promise!
+ resolve(thisPromiseCount);
+ }, Math.random() * 2000 + 1000);
+ }
+ );
+
+ // 接著透過呼叫 then() 來決定 promise 進入 resolved 時,要透過 then() 做什麼,
+ // 或是進入 rejected 時,要透過 catch() 方法要做什麼。
+ p1.then(
+ // 印出實現值(fulfillment value)
+ function(val) {
+ log.insertAdjacentHTML('beforeend', val +
+ ') Promise fulfilled (&lt;small&gt;Async code terminated&lt;/small&gt;)&lt;br/&gt;');
+ })
+ .catch(
+ // 印出失敗訊息(rejection reason)
+ (reason) =&gt; {
+ console.log('Handle rejected promise ('+reason+') here.');
+ });
+
+ log.insertAdjacentHTML('beforeend', thisPromiseCount +
+ ') Promise made (&lt;small&gt;Sync code terminated&lt;/small&gt;)&lt;br/&gt;');
+}</pre>
+
+<p><sub>*譯註:resolver function 即 executor function。</sub></p>
+
+<pre class="brush:js hidden">if ("Promise" in window) {
+ let btn = document.getElementById("btn");
+ btn.addEventListener("click",testPromise);
+} else {
+ log = document.getElementById('log');
+ log.innerHTML = "Live example not available as your browser doesn't support the &lt;code&gt;Promise&lt;code&gt; interface.";
+}
+</pre>
+
+<p>這個範例從點擊按鈕開始。您的瀏覽器需要支援 Promise。在短時間內點擊按鈕許多次,您甚至將看到不同的 promises 一個接一個地被實現。</p>
+
+<p>{{EmbedLiveSample("Advanced_Example", "500", "200")}}</p>
+
+<h2 id="使用_XHR_載入圖片">使用 XHR 載入圖片</h2>
+
+<p>另一個使用 <code>Promise</code> and <code><a href="/zh-TW/docs/Web/API/XMLHttpRequest">XMLHttpRequest</a></code> 來載入圖片的簡單例子可以在 MDN GitHub <a href="https://github.com/mdn/js-examples/tree/master/promises-test">js-examples</a> 儲存庫找到。 你也可以<a href="https://mdn.github.io/js-examples/promises-test/">see it in action</a>。每個步驟都附以註解,讓你能逐步遵隨 Promise 與 XHR 架構。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise-objects', 'Promise')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise-objects', 'Promise')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Using_promises">Using promises</a></li>
+ <li><a href="http://promisesaplus.com/">Promises/A+ specification</a></li>
+ <li><a href="https://medium.com/@ramsunvtech/promises-of-promise-part-1-53f769245a53">Venkatraman.R - JS Promise (Part 1, Basics)</a></li>
+ <li><a href="https://medium.com/@ramsunvtech/js-promise-part-2-q-js-when-js-and-rsvp-js-af596232525c#.dzlqh6ski">Venkatraman.R - JS Promise (Part 2 - Using Q.js, When.js and RSVP.js)</a></li>
+ <li><a href="https://tech.io/playgrounds/11107/tools-for-promises-unittesting/introduction">Venkatraman.R - Tools for Promises Unit Testing</a></li>
+ <li><a href="http://www.html5rocks.com/en/tutorials/es6/promises/">Jake Archibald: JavaScript Promises: There and Back Again</a></li>
+ <li><a href="http://de.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript">Domenic Denicola: Callbacks, Promises, and Coroutines – Asynchronous Programming Patterns in JavaScript</a></li>
+ <li><a href="http://www.mattgreer.org/articles/promises-in-wicked-detail/">Matt Greer: JavaScript Promises ... In Wicked Detail</a></li>
+ <li><a href="https://www.promisejs.org/">Forbes Lindesay: promisejs.org</a></li>
+ <li><a href="http://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html">Nolan Lawson: We have a problem with promises — Common mistakes with promises</a></li>
+ <li><a href="https://github.com/jakearchibald/es6-promise/">Promise polyfill</a></li>
+ <li><a href="https://www.udacity.com/course/javascript-promises--ud898">Udacity: JavaScript Promises</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html
new file mode 100644
index 0000000000..476c52f7a3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/prototype/index.html
@@ -0,0 +1,64 @@
+---
+title: Promise.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Promise/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Promise</strong></code><strong><code>.prototype</code></strong> 屬性代表了 {{jsxref("Promise")}} 建構式的原型物件。</p>
+
+<div>{{js_property_attributes(0,0,0)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p>所有 {{jsxref("Promise")}} 實例都繼承自 {{jsxref("Promise.prototype")}}。您可以使用建構式的原型物件來增加屬性或方法到所有的 <code>Promise</code> 實例。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt><code>Promise.prototype.constructor</code></dt>
+ <dd>回傳一個建立實例原型(instance's prototype)的函式。預設為 {{jsxref("Promise")}} 函數。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Promise.catch", "Promise.prototype.catch(onRejected)")}}</dt>
+ <dd>繫結一個拒絕回呼函式(rejection handler callback)到 promise,當它被呼叫時回傳一個以回傳值作解析的新 promise,或者當 promise 被實現時以原值作解析。</dd>
+ <dt>{{jsxref("Promise.then", "Promise.prototype.then(onFulfilled, onRejected)")}}</dt>
+ <dd>繫結實現或拒絕回呼函式到 promise,回傳一個以 handler 之回傳值作解析的新 promise,或者當 promise 未處理(not handled)時以原值作解析。(i.e. 比如相關聯的 <code>onFulfilled</code> 或 <code>onRejected</code> 不是函式。)</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-promise.prototype', 'Promise.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.prototype', 'Promise.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this file: <a href="https://github.com/mdn/browser-compat-data/blob/master/javascript/promise.json">https://github.com/mdn/browser-compat-data/blob/master/javascript/promise.json</a>.</p>
+
+<p>{{Compat("javascript/promise","Promise.prototype")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/race/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/race/index.html
new file mode 100644
index 0000000000..9f0d8b4d2e
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/race/index.html
@@ -0,0 +1,171 @@
+---
+title: Promise.race()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/race
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/race
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Promise.race(iterable)</strong></code> 方法回傳一個 promise 物件,此 promise 物件會於 iterable 引數中任一個 promise 轉為 resolve 或 rejected 時立即轉變成 resolve 或 rejected,並且接收其成功值或失敗訊息。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>Promise.race(iterable)</var>;</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>iterable</dt>
+ <dd>一個 iterable 物件,像是 {{jsxref("Array")}}. 請參考<a href="/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols#可迭代協議">可迭代協議</a>。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>當傳入的 iterable 中有 promise 被實現或拒絕時,立刻回傳被實現或拒絕的 {{jsxref("Promise")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>race</code> 函式回傳一個與傳入的 iterable 之中第一個被解決(settled)的 promise 相同方式被解決(且以相同值)的 <code>Promise</code>。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Promise.race_的非同步性質"><font face="consolas, Liberation Mono, courier, monospace"><code>Promise.race</code> 的非同步性質</font></h3>
+
+<p><code><font face="Open Sans, arial, x-locale-body, sans-serif">以下例子演示了 </font>Promise.race</code> <code>的非同步性質:</code></p>
+
+<pre class="brush: js">// we are passing as argument an array of promises that are already resolved,
+// to trigger Promise.race as soon as possible
+var resolvedPromisesArray = [Promise.resolve(33), Promise.resolve(44)];
+
+var p = Promise.race(resolvedPromisesArray);
+// immediately logging the value of p
+console.log(p);
+
+// using setTimeout we can execute code after the stack is empty
+setTimeout(function(){
+ console.log('the stack is now empty');
+ console.log(p);
+});
+
+// logs, in order:
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: 33 }</pre>
+
+<p>一個空的 iterable 造成回傳的 promise 永久擱置:</p>
+
+<pre class="brush: js">var foreverPendingPromise = Promise.race([]);
+console.log(foreverPendingPromise);
+setTimeout(function(){
+ console.log('the stack is now empty');
+ console.log(foreverPendingPromise);
+});
+
+// logs, in order:
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "pending" }
+</pre>
+
+<p>若 iterable 中有一個或多個非 promise 值且/或一個已經被實現/解決的 promise,<code>Promise.race</code> 將以陣列中第一個這樣的值解決:</p>
+
+<pre class="brush: js">var foreverPendingPromise = Promise.race([]);
+var alreadyResolvedProm = Promise.resolve(666);
+
+var arr = [foreverPendingPromise, alreadyResolvedProm, "non-Promise value"];
+var arr2 = [foreverPendingPromise, "non-Promise value", Promise.resolve(666)];
+var p = Promise.race(arr);
+var p2 = Promise.race(arr2);
+
+console.log(p);
+console.log(p2);
+setTimeout(function(){
+    console.log('the stack is now empty');
+    console.log(p);
+ console.log(p2);
+});
+
+// logs, in order:
+// Promise { &lt;state&gt;: "pending" }
+// Promise { &lt;state&gt;: "pending" }
+// the stack is now empty
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: 666 }
+// Promise { &lt;state&gt;: "fulfilled", &lt;value&gt;: "non-Promise value" }
+</pre>
+
+<h3 id="使用_Promise.race_–_及_setTimeout_的範例">使用 <code>Promise.race</code> – 及 <code><a href="/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout">setTimeout</a></code> 的範例</h3>
+
+<pre class="brush: js">var p1 = new Promise(function(resolve, reject) {
+ setTimeout(resolve, 500, 'one');
+});
+var p2 = new Promise(function(resolve, reject) {
+ setTimeout(resolve, 100, 'two');
+});
+
+Promise.race([p1, p2]).then(function(value) {
+ console.log(value); // "two"
+ // Both resolve, but p2 is faster
+});
+
+var p3 = new Promise(function(resolve, reject) {
+ setTimeout(resolve, 100, 'three');
+});
+var p4 = new Promise(function(resolve, reject) {
+ setTimeout(reject, 500, 'four');
+});
+
+Promise.race([p3, p4]).then(function(value) {
+ console.log(value); // "three"
+ // p3 is faster, so it resolves
+}, function(reason) {
+ // Not called
+});
+
+var p5 = new Promise(function(resolve, reject) {
+ setTimeout(resolve, 500, 'five');
+});
+var p6 = new Promise(function(resolve, reject) {
+ setTimeout(reject, 100, 'six');
+});
+
+Promise.race([p5, p6]).then(function(value) {
+ // Not called
+}, function(reason) {
+ console.log(reason); // "six"
+ // p6 is faster, so it rejects
+});
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.race', 'Promise.race')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.race', 'Promise.race')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.Promise.race")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Promise.all()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/reject/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/reject/index.html
new file mode 100644
index 0000000000..0c41a37509
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/reject/index.html
@@ -0,0 +1,72 @@
+---
+title: Promise.reject()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/reject
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/reject
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Promise.reject(reason)</strong></code><strong> </strong>方法回傳一個以 <code>reason</code> 拒絕的 <code>Promise</code> 物件。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>Promise.reject(reason)</var>;</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>reason</dt>
+ <dd><code>Promise</code> 的失敗訊息。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個以 <code>reason</code> 拒絕的 {{jsxref("Promise")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>靜態函式 <code>Promise.reject</code> 回傳一個被拒絕的 <code>Promise。由於除錯目的及選擇性錯誤捕捉(selective error catching),使</code>用一個 <code>instanceof</code> {{jsxref("Error")}} 作為 reason 是很有幫助的。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用靜態方法_Promise.reject()">使用靜態方法 Promise.reject()</h3>
+
+<pre class="brush: js">Promise.reject(new Error('fail')).then(function(error) {
+ // not called
+}, function(error) {
+ console.log(error); // Stacktrace
+});</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.reject', 'Promise.reject')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.reject', 'Promise.reject')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise.reject")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li><a href="https://github.com/petkaantonov/bluebird#error-handling">Selective error catching using the BlueBird Promise library</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/resolve/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/resolve/index.html
new file mode 100644
index 0000000000..e2d460a7e3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/resolve/index.html
@@ -0,0 +1,142 @@
+---
+title: Promise.resolve()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/resolve
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/resolve
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Promise.resolve(value)</strong></code> 方法回傳一個以 value 判定結果的 {{jsxref("Promise")}} 物件。若 value 是個 thenable (例如,具有 {{jsxref("Promise.then", "\"then\"方法")}}),則回傳的 promise 將依其結果採取其最終狀態;若 value 是 promise,則作為呼叫 Promise.resolve 之結果;其他情形都將回傳以 value 實現的 promise。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">Promise.resolve(value);
+Promise.resolve(promise);
+Promise.resolve(thenable);
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>value</dt>
+ <dd>將被 <code>Promise</code> 實現的引數(argument)。可以是個 <code>Promise</code> 或待解決的 thenable。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>以 value 或作為 value 的 promise 解決的 {{jsxref("Promise")}}。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>靜態函式</code> <code>Promise.resolve</code> 回傳判定後的 <code>Promise。</code></p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Promise.resolve_靜態方法">使用 <code>Promise.resolve</code> 靜態方法</h3>
+
+<pre class="brush: js">Promise.resolve('Success').then(function(value) {
+ console.log(value); // "Success"
+}, function(value) {
+ // not called
+});
+</pre>
+
+<h3 id="判定陣列">判定陣列</h3>
+
+<pre class="brush: js">var p = Promise.resolve([1,2,3]);
+p.then(function(v) {
+ console.log(v[0]); // 1
+});
+</pre>
+
+<h3 id="判定另一個_Promise">判定另一個 <code>Promise</code></h3>
+
+<pre class="brush: js">var original = Promise.resolve(33);
+var cast = Promise.resolve(original);
+cast.then(function(value) {
+  console.log('value: ' + value);
+});
+console.log('original === cast ? ' + (original === cast));
+
+// logs, in order:
+// original === cast ? true
+// value: 33
+</pre>
+
+<p>由於 handlers 是非同步地被調用而導致相反的紀錄順序。經由<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Promise/then#回傳值">這篇文章</a>了解 then 如何運作。</p>
+
+<h3 id="判定_thenables_及拋出_Errors">判定 thenables 及拋出 Errors</h3>
+
+<pre class="brush: js">// Resolving a thenable object
+var p1 = Promise.resolve({
+ then: function(onFulfill, onReject) { onFulfill('fulfilled!'); }
+});
+console.log(p1 instanceof Promise) // true, object casted to a Promise
+
+p1.then(function(v) {
+ console.log(v); // "fulfilled!"
+ }, function(e) {
+ // not called
+});
+
+// Thenable throws before callback
+// Promise rejects
+var thenable = { then: function(resolve) {
+ throw new TypeError('Throwing');
+ resolve('Resolving');
+}};
+
+var p2 = Promise.resolve(thenable);
+p2.then(function(v) {
+ // not called
+}, function(e) {
+ console.log(e); // TypeError: Throwing
+});
+
+// Thenable throws after callback
+// Promise resolves
+var thenable = { then: function(resolve) {
+ resolve('Resolving');
+ throw new TypeError('Throwing');
+}};
+
+var p3 = Promise.resolve(thenable);
+p3.then(function(v) {
+ console.log(v); // "Resolving"
+}, function(e) {
+ // not called
+});
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.resolve', 'Promise.resolve')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.resolve', 'Promise.resolve')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.Promise.resolve")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html
new file mode 100644
index 0000000000..19682d0199
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/promise/then/index.html
@@ -0,0 +1,271 @@
+---
+title: Promise.prototype.then()
+slug: Web/JavaScript/Reference/Global_Objects/Promise/then
+translation_of: Web/JavaScript/Reference/Global_Objects/Promise/then
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>then()</code> </strong>方法回傳一個 {{domxref("Promise")}} 物件。它接收兩個引數: <code>Promise</code> 在成功及失敗情況時的回呼函式。</p>
+
+<div class="note">
+<p>如果有一個或兩個引數被省略,或為非函式(non-functions),則 <code>then</code> 將處於遺失 handler(s) 的狀態,但不會產生錯誤。若發起 <code>then</code> 之 <code>Promise</code> 採取了一個狀態(實現(<code>fulfillment)</code>或拒絕(<code>rejection))</code>而 <code>then</code> 沒有處理它的函式,一個不具有額外 handlers 的新 <code>Promise</code> 物件將被建立,單純採取原 <code>Promise</code> 其最終狀態。</p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>p.then(onFulfilled[, onRejected])</var>;
+
+p.then(function(value) {
+ // fulfillment
+}, function(reason) {
+ // rejection
+});
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>onFulfilled</code></dt>
+ <dd>一個 {{jsxref("Function")}},當 <code>Promise</code> 被實現(fulfilled)時被呼叫。此函式接收一個實現值(<code>fullfillment value)作為引數。</code></dd>
+ <dt><code>onRejected </code>{{optional_inline}}</dt>
+ <dd>一個 {{jsxref("Function")}},當 <code>Promise</code> 被拒絕(rejected)時被呼叫。此函式接收一個失敗訊息(<code>rejection reason)作為引數。</code></dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個進入<strong>擱置(pending)</strong>狀態的 {{jsxref("Promise")}}。(只要堆疊一空)handler 函式<strong>非同步地(asynchronously)</strong>被呼叫。在調用 handler 後,若 handler 函式:</p>
+
+<ul>
+ <li>回傳一個值,則 <code>then</code> 回傳之 promise 以此值被實現(resolved)。</li>
+ <li>拋出一個例外,則 <code>then</code> 回傳之 promise 以此例外被否決(rejected)。</li>
+ <li>回傳一個被實現的 promise,則 <code>then</code> 回傳之 promise 以此值被實現。</li>
+ <li>回傳一個被否決的 promise,則 <code>then</code> 回傳之 promise 以此值被否決。</li>
+ <li>回傳另一個被<strong>擱置</strong>的 promise 物件,則 <code>then</code> 回傳之 promise 之實現/拒絕隨後由處理函式之實現/否決決定。並且,<code>then</code> 回傳之 promise 將與處理函式回傳之 promise 以相同值被解決。</li>
+</ul>
+
+<p>以下例子展示 <code>then</code> 方法的非同步性質(asynchronicity)。</p>
+
+<pre class="brush: js">// 使用一個已實現的 promise,'then' 區塊將立即被觸發,但是它的 handlers 將是非同步地被觸發,如同 console.logs 所示
+var resolvedProm = Promise.resolve(33);
+
+var thenProm = resolvedProm.then(function(value){
+ console.log("我在 main stack 之後被呼叫。收到及將回傳的值為:" + value);
+ return value;
+});
+// 立即紀錄 thenProm
+console.log(thenProm);
+
+// 我們可以使用 setTimeout 以延遲(postpone)函式執行直到堆疊為空
+setTimeout(function(){
+    console.log(thenProm);
+});
+
+
+// 紀錄結果,依序為:
+// Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
+// "我在 main stack 之後被呼叫。收到及將回傳的值為:33"
+// Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: 33}
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>因為 <code>then</code> 和 {{jsxref("Promise.prototype.catch()")}} 方法都回傳 promises,它們可以被串接 — 稱為組合(<em>composition)。</em></p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="運用_then_方法">運用 <code>then</code> 方法</h3>
+
+<pre class="brush: js">var p1 = new Promise( (resolve, reject) =&gt; {
+ resolve('Success!');
+ // or
+ // reject ("Error!");
+} );
+
+p1.then( value =&gt; {
+ console.log(value); // Success!
+}, reason =&gt; {
+ console.log(reason); // Error!
+} );
+</pre>
+
+<h3 id="串接">串接</h3>
+
+<p><code>then</code> 方法回傳一個 <code>Promise</code> 而可以進行方法串接(method chaining)。</p>
+
+<p>如果傳入 <code>then</code> 的 handler 函式回傳一個 promise,一個等價的 <code>Promise</code> 將被展現給方法串接中的下一個 then 。以下程式碼片段透過 <code>setTimout</code> 函式模擬非同步程式碼。</p>
+
+<pre class="brush: js">Promise.resolve('foo')
+ // 1. Receive "foo" concatenate "bar" to it and resolve that to the next then
+ .then(function(string) {
+ return new Promise(function(resolve, reject) {
+ setTimeout(function() {
+ string += 'bar';
+ resolve(string);
+ }, 1);
+ });
+ })
+ // 2. receive "foobar", register a callback function to work on that string
+ // and print it to the console, but not before return the unworked on
+ // string to the next then
+ .then(function(string) {
+ setTimeout(function() {
+ string += 'baz';
+ console.log(string);
+ }, 1)
+ return string;
+ })
+ // 3. print helpful messages about how the code in this section will be run
+ // before string is actually processed by the mocked asynchronous code in the
+ // prior then block.
+ .then(function(string) {
+ console.log("Last Then: oops... didn't bother to instantiate and return " +
+ "a promise in the prior then so the sequence may be a bit " +
+ "surprising");
+
+ // Note that `string` will not have the 'baz' bit of it at this point. This
+ // is because we mocked that to happen asynchronously with a setTimeout function
+ console.log(string);
+ });</pre>
+
+<p>當 handler 僅回傳一個值,實際上它將回傳 <code>Promise.resolve(&lt;value returned by whichever handler was called&gt;)</code>.</p>
+
+<pre class="brush: js">var p2 = new Promise(function(resolve, reject) {
+ resolve(1);
+});
+
+p2.then(function(value) {
+ console.log(value); // 1
+ return value + 1;
+}).then(function(value) {
+ console.log(value + '- This synchronous usage is virtually pointless'); // 2- This synchronous usage is virtually pointless
+});
+
+p2.then(function(value) {
+ console.log(value); // 1
+});
+</pre>
+
+<p>若函式拋出一個錯誤或回傳一個被否決的 Promise,<code>then</code> 也將回傳一個被否決的 Promise。</p>
+
+<pre class="brush: js">Promise.resolve()
+ .then( () =&gt; {
+ // 使 .then() 回傳一個被否決的 Promise
+ throw 'Oh no!';
+ })
+ .then( () =&gt; {
+ console.log( 'Not called.' );
+ }, reason =&gt; {
+ console.error( 'onRejected function called: ', reason );
+ });</pre>
+
+<p>在所有其他情形,實現中的 Promise 被回傳。在以下例子中,第一個 <code>then()</code> 將回傳一個實現中包裹 42 的 promise,即使串接中的前一個 Promise 被否決。</p>
+
+<pre class="brush: js">Promise.reject()
+ .then( () =&gt; 99, () =&gt; 42 ) // onRejected returns 42 which is wrapped in a resolving Promise
+ .then( solution =&gt; console.log( 'Resolved with ' + solution ) ); // Resolved with 42</pre>
+
+<p>實務上,使用 <code>catch</code> 捕捉被否決的 promise 較理想的,而不建議使用兩個引數 <code>then</code> 語法,如下展示。</p>
+
+<pre class="brush: js">Promise.resolve()
+ .then( () =&gt; {
+ // Makes .then() return a rejected promise
+ throw 'Oh no!';
+ })
+ .catch( reason =&gt; {
+ console.error( 'onRejected function called: ', reason );
+ })
+ .then( () =&gt; {
+ console.log( "I am always called even if the prior then's promise rejects" );
+ });</pre>
+
+<p><br>
+ 你也可以透過串接實作一個 Promise-based API 函式,基於它本身。</p>
+
+<pre class="brush: js">function fetch_current_data() {
+ // The <a href="/en-US/docs/Web/API/GlobalFetch/fetch">fetch</a>() API returns a Promise. This function
+ // exposes a similar API, except the fulfillment
+ // value of this function's Promise has had more
+ // work done on it.
+ return fetch('current-data.json').then((response) =&gt; {
+ if (response.headers.get('content-type') != 'application/json') {
+ throw new TypeError();
+ }
+ var j = response.json();
+ // maybe do something with j
+ return j; // fulfillment value given to user of
+ // fetch_current_data().then()
+ });
+}
+</pre>
+
+<p>若 <code>onFulfilled</code> 回傳一個 promise,則 <code>then</code> 的實現/否決將取決它。</p>
+
+<pre class="brush: js">function resolveLater(resolve, reject) {
+ setTimeout(function () {
+ resolve(10);
+ }, 1000);
+}
+function rejectLater(resolve, reject) {
+ setTimeout(function () {
+ reject(20);
+ }, 1000);
+}
+
+var p1 = Promise.resolve('foo');
+var p2 = p1.then(function() {
+ // Return promise here, that will be resolved to 10 after 1 second
+ return new Promise(resolveLater);
+});
+p2.then(function(v) {
+ console.log('resolved', v); // "resolved", 10
+}, function(e) {
+ // not called
+ console.log('rejected', e);
+});
+
+var p3 = p1.then(function() {
+ // Return promise here, that will be rejected with 20 after 1 second
+ return new Promise(rejectLater);
+});
+p3.then(function(v) {
+ // not called
+ console.log('resolved', v);
+}, function(e) {
+ console.log('rejected', e); // "rejected", 20
+});
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-promise.prototype.then', 'Promise.prototype.then')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition in an ECMA standard.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-promise.prototype.then', 'Promise.prototype.then')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">To contribute to this compatibility data, please write a pull request against this file: <a href="https://github.com/mdn/browser-compat-data/blob/master/javascript/promise.json">https://github.com/mdn/browser-compat-data/blob/master/javascript/promise.json</a>.</p>
+
+<p>{{Compat("javascript/promise","Promise.prototype.then")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Promise")}}</li>
+ <li>{{jsxref("Promise.prototype.catch()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/proxy/index.html b/files/zh-tw/web/javascript/reference/global_objects/proxy/index.html
new file mode 100644
index 0000000000..54a71be888
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/proxy/index.html
@@ -0,0 +1,400 @@
+---
+title: Proxy
+slug: Web/JavaScript/Reference/Global_Objects/Proxy
+tags:
+ - Class
+ - ECMAScript 2015
+ - JavaScript
+ - Proxy
+translation_of: Web/JavaScript/Reference/Global_Objects/Proxy
+---
+<div>
+<div>{{JSRef}}</div>
+</div>
+
+<p><strong>Proxy</strong> 物件被使用於定義基本操作的自定行為(例如:尋找屬性、賦值、列舉、函式調用等等)。</p>
+
+<h2 id="術語">術語</h2>
+
+<dl>
+ <dt><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">handler</a></dt>
+ <dd>Placeholder object which contains traps.</dd>
+ <dt>traps</dt>
+ <dd>The methods that provide property access. This is analogous to the concept of traps in operating systems.</dd>
+ <dt>target</dt>
+ <dd>Object which the proxy virtualizes. It is often used as storage backend for the proxy. Invariants (semantics that remain unchanged) regarding object non-extensibility or non-configurable properties are verified against the target.</dd>
+</dl>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">var p = new Proxy(target, handler);
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>target</code></dt>
+ <dd>A target object (can be any sort of object, including a native array, a function or even another proxy) to wrap with <code>Proxy</code>.</dd>
+ <dt><code>handler</code></dt>
+ <dd>An object whose properties are functions which define the behavior of the proxy when an operation is performed on it.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Proxy.revocable()")}}</dt>
+ <dd>Creates a revocable <code>Proxy</code> object.</dd>
+</dl>
+
+<h2 id="Methods_of_the_handler_object">Methods of the handler object</h2>
+
+<p>The handler object is a placeholder object which contains traps for <code>Proxy</code>.</p>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler', 'Methods') }}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Basic_example">Basic example</h3>
+
+<p>In this simple example the number <code>37</code> gets returned as the default value when the property name is not in the object. It is using the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/get"><code>get</code></a> handler.</p>
+
+<pre class="brush: js notranslate">var handler = {
+ get: function(target, name) {
+ return name in target ?
+ target[name] :
+ 37;
+ }
+};
+
+var p = new Proxy({}, handler);
+p.a = 1;
+p.b = undefined;
+
+console.log(p.a, p.b); // 1, undefined
+console.log('c' in p, p.c); // false, 37
+</pre>
+
+<h3 id="No-op_forwarding_proxy">No-op forwarding proxy</h3>
+
+<p>In this example, we are using a native JavaScript object to which our proxy will forward all operations that are applied to it.</p>
+
+<pre class="brush: js notranslate">var target = {};
+var p = new Proxy(target, {});
+
+p.a = 37; // operation forwarded to the target
+
+console.log(target.a); // 37. The operation has been properly forwarded
+</pre>
+
+<h3 id="Validation">Validation</h3>
+
+<p>With a <code>Proxy</code>, you can easily validate the passed value for an object. This example uses the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/set"><code>set</code></a> handler.</p>
+
+<pre class="brush: js notranslate">let validator = {
+ set: function(obj, prop, value) {
+ if (prop === 'age') {
+ if (!Number.isInteger(value)) {
+ throw new TypeError('The age is not an integer');
+ }
+ if (value &gt; 200) {
+ throw new RangeError('The age seems invalid');
+ }
+ }
+
+ // The default behavior to store the value
+ obj[prop] = value;
+
+ // Indicate success
+ return true;
+ }
+};
+
+let person = new Proxy({}, validator);
+
+person.age = 100;
+console.log(person.age); // 100
+person.age = 'young'; // Throws an exception
+person.age = 300; // Throws an exception</pre>
+
+<h3 id="Extending_constructor">Extending constructor</h3>
+
+<p>A function proxy could easily extend a constructor with a new constructor. This example uses the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/construct"><code>construct</code></a> and <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/apply"><code>apply</code></a> handlers.</p>
+
+<pre class="brush: js notranslate">function extend(sup, base) {
+ var descriptor = Object.getOwnPropertyDescriptor(
+ base.prototype, 'constructor'
+ );
+ base.prototype = Object.create(sup.prototype);
+ var handler = {
+ construct: function(target, args) {
+ var obj = Object.create(base.prototype);
+ this.apply(target, obj, args);
+ return obj;
+ },
+ apply: function(target, that, args) {
+ sup.apply(that, args);
+ base.apply(that, args);
+ }
+ };
+ var proxy = new Proxy(base, handler);
+ descriptor.value = proxy;
+ Object.defineProperty(base.prototype, 'constructor', descriptor);
+ return proxy;
+}
+
+var Person = function(name) {
+ this.name = name;
+};
+
+var Boy = extend(Person, function(name, age) {
+ this.age = age;
+});
+
+Boy.prototype.sex = 'M';
+
+var Peter = new Boy('Peter', 13);
+console.log(Peter.sex); // "M"
+console.log(Peter.name); // "Peter"
+console.log(Peter.age); // 13</pre>
+
+<h3 id="Manipulating_DOM_nodes">Manipulating DOM nodes</h3>
+
+<p>Sometimes you want to toggle the attribute or class name of two different elements. Here's how using the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/set"><code>set</code></a> handler.</p>
+
+<pre class="brush: js notranslate">let view = new Proxy({
+ selected: null
+},
+{
+ set: function(obj, prop, newval) {
+ let oldval = obj[prop];
+
+ if (prop === 'selected') {
+ if (oldval) {
+ oldval.setAttribute('aria-selected', 'false');
+ }
+ if (newval) {
+ newval.setAttribute('aria-selected', 'true');
+ }
+ }
+
+ // The default behavior to store the value
+ obj[prop] = newval;
+
+ // Indicate success
+ return true;
+ }
+});
+
+let i1 = view.selected = document.getElementById('item-1');
+console.log(i1.getAttribute('aria-selected')); // 'true'
+
+let i2 = view.selected = document.getElementById('item-2');
+console.log(i1.getAttribute('aria-selected')); // 'false'
+console.log(i2.getAttribute('aria-selected')); // 'true'</pre>
+
+<h3 id="Value_correction_and_an_extra_property">Value correction and an extra property</h3>
+
+<p>The <code>products</code> proxy object evaluates the passed value and convert it to an array if needed. The object also supports an extra property called <code>latestBrowser</code> both as a getter and a setter.</p>
+
+<pre class="brush: js notranslate">let products = new Proxy({
+ browsers: ['Internet Explorer', 'Netscape']
+},
+{
+ get: function(obj, prop) {
+ // An extra property
+ if (prop === 'latestBrowser') {
+ return obj.browsers[obj.browsers.length - 1];
+ }
+
+ // The default behavior to return the value
+ return obj[prop];
+ },
+ set: function(obj, prop, value) {
+ // An extra property
+ if (prop === 'latestBrowser') {
+ obj.browsers.push(value);
+ return true;
+ }
+
+ // Convert the value if it is not an array
+ if (typeof value === 'string') {
+ value = [value];
+ }
+
+ // The default behavior to store the value
+ obj[prop] = value;
+
+ // Indicate success
+ return true;
+ }
+});
+
+console.log(products.browsers); // ['Internet Explorer', 'Netscape']
+products.browsers = 'Firefox'; // pass a string (by mistake)
+console.log(products.browsers); // ['Firefox'] &lt;- no problem, the value is an array
+
+products.latestBrowser = 'Chrome';
+console.log(products.browsers); // ['Firefox', 'Chrome']
+console.log(products.latestBrowser); // 'Chrome'</pre>
+
+<h3 id="Finding_an_array_item_object_by_its_property">Finding an array item object by its property</h3>
+
+<p>This proxy extends an array with some utility features. As you see, you can flexibly "define" properties without using <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties"><code>Object.defineProperties</code></a>. This example can be adapted to find a table row by its cell. In that case, the target will be <a href="/en-US/docs/DOM/table.rows"><code>table.rows</code></a>.</p>
+
+<pre class="brush: js notranslate">let products = new Proxy([
+ { name: 'Firefox', type: 'browser' },
+ { name: 'SeaMonkey', type: 'browser' },
+ { name: 'Thunderbird', type: 'mailer' }
+],
+{
+ get: function(obj, prop) {
+ // The default behavior to return the value; prop is usually an integer
+ if (prop in obj) {
+ return obj[prop];
+ }
+
+ // Get the number of products; an alias of products.length
+ if (prop === 'number') {
+ return obj.length;
+ }
+
+ let result, types = {};
+
+ for (let product of obj) {
+ if (product.name === prop) {
+ result = product;
+ }
+ if (types[product.type]) {
+ types[product.type].push(product);
+ } else {
+ types[product.type] = [product];
+ }
+ }
+
+ // Get a product by name
+ if (result) {
+ return result;
+ }
+
+ // Get products by type
+ if (prop in types) {
+ return types[prop];
+ }
+
+ // Get product types
+ if (prop === 'types') {
+ return Object.keys(types);
+ }
+
+ return undefined;
+ }
+});
+
+console.log(products[0]); // { name: 'Firefox', type: 'browser' }
+console.log(products['Firefox']); // { name: 'Firefox', type: 'browser' }
+console.log(products['Chrome']); // undefined
+console.log(products.browser); // [{ name: 'Firefox', type: 'browser' }, { name: 'SeaMonkey', type: 'browser' }]
+console.log(products.types); // ['browser', 'mailer']
+console.log(products.number); // 3
+</pre>
+
+<h3 id="A_complete_traps_list_example">A complete <code>traps</code> list example</h3>
+
+<p>Now in order to create a complete sample <code>traps</code> list, for didactic purposes, we will try to proxify a <em>non native</em> object that is particularly suited to this type of operation: the <code>docCookies</code> global object created by <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie/Simple_document.cookie_framework" title="https://developer.mozilla.org/en-US/docs/DOM/document.cookie#A_little_framework.3A_a_complete_cookies_reader.2Fwriter_with_full_unicode_support">the "little framework" published on the <code>document.cookie</code> page</a>.</p>
+
+<pre class="brush: js notranslate">/*
+ var docCookies = ... get the "docCookies" object here:
+ https://developer.mozilla.org/en-US/docs/DOM/document.cookie#A_little_framework.3A_a_complete_cookies_reader.2Fwriter_with_full_unicode_support
+*/
+
+var docCookies = new Proxy(docCookies, {
+ get: function (oTarget, sKey) {
+ return oTarget[sKey] || oTarget.getItem(sKey) || undefined;
+ },
+ set: function (oTarget, sKey, vValue) {
+ if (sKey in oTarget) { return false; }
+ return oTarget.setItem(sKey, vValue);
+ },
+ deleteProperty: function (oTarget, sKey) {
+ if (sKey in oTarget) { return false; }
+ return oTarget.removeItem(sKey);
+ },
+ enumerate: function (oTarget, sKey) {
+ return oTarget.keys();
+ },
+ ownKeys: function (oTarget, sKey) {
+ return oTarget.keys();
+ },
+ has: function (oTarget, sKey) {
+ return sKey in oTarget || oTarget.hasItem(sKey);
+ },
+ defineProperty: function (oTarget, sKey, oDesc) {
+ if (oDesc &amp;&amp; 'value' in oDesc) { oTarget.setItem(sKey, oDesc.value); }
+ return oTarget;
+ },
+ getOwnPropertyDescriptor: function (oTarget, sKey) {
+ var vValue = oTarget.getItem(sKey);
+ return vValue ? {
+ value: vValue,
+ writable: true,
+ enumerable: true,
+ configurable: false
+ } : undefined;
+ },
+});
+
+/* Cookies test */
+
+console.log(docCookies.my_cookie1 = 'First value');
+console.log(docCookies.getItem('my_cookie1'));
+
+docCookies.setItem('my_cookie1', 'Changed value');
+console.log(docCookies.my_cookie1);</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-proxy-objects', 'Proxy')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-proxy-objects', 'Proxy')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{Compat("javascript.builtins.Proxy", 2)}}</p>
+
+<h2 id="Gecko_specific_notes">Gecko specific notes</h2>
+
+<ul>
+ <li>At present, <code>Object.getPrototypeOf(proxy)</code> unconditionally returns <code>Object.getPrototypeOf(target)</code>, because the ES2015 getPrototypeOf trap is not yet implemented ({{bug(795904)}}, {{bug(888969)}}).</li>
+ <li><code>Array.isArray(proxy)</code> unconditionally returns <code>Array.isArray(target)</code> ({{bug(1096753)}}, {{bug(1111785)}}).</li>
+ <li><code>Object.prototype.toString.call(proxy)</code> unconditionally returns <code>Object.prototype.toString.call(target)</code>, because ES2015 Symbol.toStringTag is not yet implemented ({{bug(1114580)}}).</li>
+</ul>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a class="external" href="https://www.youtube.com/watch?v=sClk6aB_CPk">"Proxies are awesome" Brendan Eich presentation at JSConf</a> (<a class="external" href="http://www.slideshare.net/BrendanEich/metaprog-5303821">slides</a>)</li>
+ <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:proxies">ECMAScript Harmony Proxy proposal page</a> and <a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:proxies_semantics">ECMAScript Harmony proxy semantics page</a></li>
+ <li><a class="external" href="http://soft.vub.ac.be/~tvcutsem/proxies/">Tutorial on proxies</a></li>
+ <li><a href="/en-US/docs/JavaScript/Old_Proxy_API" title="/en-US/docs/JavaScript/Old_Proxy_API">SpiderMonkey specific Old Proxy API</a></li>
+ <li>{{jsxref("Object.watch()")}} is a non-standard feature but has been supported in Gecko for a long time.</li>
+</ul>
+
+<h2 id="Licensing_note">Licensing note</h2>
+
+<p>Some content (text, examples) in this page has been copied or adapted from the <a class="external" href="http://wiki.ecmascript.org/doku.php">ECMAScript wiki</a> which content is licensed <a class="external" href="http://creativecommons.org/licenses/by-nc-sa/2.0/">CC 2.0 BY-NC-SA</a>.</p>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/rangeerror/index.html b/files/zh-tw/web/javascript/reference/global_objects/rangeerror/index.html
new file mode 100644
index 0000000000..257c23be9a
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/rangeerror/index.html
@@ -0,0 +1,152 @@
+---
+title: RangeError
+slug: Web/JavaScript/Reference/Global_Objects/RangeError
+tags:
+ - Error
+ - JavaScript
+ - Object
+ - RangeError
+translation_of: Web/JavaScript/Reference/Global_Objects/RangeError
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>RangeError</strong></code>物件在一個給定的值不在允許的集合或範圍內時被作為一個錯誤拋出</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>new RangeError([<var>message</var>[, <var>fileName</var>[, <var>lineNumber</var>]]])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>message</code></dt>
+ <dd>可選。具人類可讀性的錯誤說明</dd>
+ <dt><code>fileName</code> {{non-standard_inline}}</dt>
+ <dd>可選。包含造成錯誤發生的程式碼的檔案名稱</dd>
+ <dt><code>lineNumber</code> {{non-standard_inline}}</dt>
+ <dd>可選。造成錯誤發生的程式碼行號</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>當試著往一個 function 傳入一個不被其允許的值作為參數時,一個<code>RangeError</code>被拋出。這可在多種情況遭遇到,例如傳入一個不被允許的字串值到 {{jsxref("String.prototype.normalize()")}},或試著透過 {{jsxref("Array")}} constructor 用一個不合法的長度來創建一個陣列,或往數值方法像是{{jsxref("Number.toExponential()")}}、{{jsxref("Number.toFixed()")}}、{{jsxref("Number.toPrecision()")}} 傳進糟糕的值。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("RangeError.prototype")}}</dt>
+ <dd>允許對一個 <code>RangeError</code> 物件增加其屬性。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>普遍的 <code>RangeError</code> 自身沒有包含方法,儘管他的確從原型鍊中繼承了一些。</p>
+
+<h2 id="RangeError_物件實體"><code>RangeError</code> 物件實體</h2>
+
+<h3 id="屬性_2">屬性</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError/prototype', 'Properties')}}</div>
+
+<h3 id="方法_2">方法</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError/prototype', 'Methods')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_RangeError_(數值)">使用 <code>RangeError</code> (數值)</h3>
+
+<pre class="brush: js">function check(n)
+{
+    if(!(n &gt;= -500 &amp;&amp; n &lt;= 500))
+    {
+        throw new RangeError("The argument must be between -500 and 500.");
+    }
+}
+
+try
+{
+    check(2000);
+}
+catch(error)
+{
+ if(error instanceof RangeError)
+  {
+ // Handle the error.
+ }
+}</pre>
+
+<h3 id="使用_RangeError_(非數值)">使用 <code>RangeError</code> (非數值)</h3>
+
+<pre class="brush: js">function check(value)
+{
+    if(["apple", "banana", "carrot"].includes(value) === false)
+    {
+        throw new RangeError("The argument must be an \"apple\", \"banana\", or \"carrot\".");
+    }
+}
+
+try
+{
+    check("cabbage");
+}
+catch(error)
+{
+ if(error instanceof RangeError)
+  {
+ // Handle the error.
+ }
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">注解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.11.6.2', 'RangeError')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-native-error-types-used-in-this-standard-rangeerror', 'RangeError')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-rangeerror', 'RangeError')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.RangeError")}}</p>
+</div>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Error")}}</li>
+ <li>{{jsxref("RangeError.prototype")}}</li>
+ <li>{{jsxref("Array")}}</li>
+ <li>{{jsxref("Number.toExponential()")}}</li>
+ <li>{{jsxref("Number.toFixed()")}}</li>
+ <li>{{jsxref("Number.toPrecision()")}}</li>
+ <li>{{jsxref("String.prototype.normalize()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html
new file mode 100644
index 0000000000..4f1d980a0d
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html
@@ -0,0 +1,130 @@
+---
+title: Reflect
+slug: Web/JavaScript/Reference/Global_Objects/Reflect
+translation_of: Web/JavaScript/Reference/Global_Objects/Reflect
+---
+<div>{{JSRef}}</div>
+
+<p><strong>Reflect</strong> 是一個內建物件,提供了用於獲取可截取之 JavaScript 操作的方法。這些方法與 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handlers</a> 的方法相同。<code>Reflect</code> 不是一個函式物件,因此它是不可建構的。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>Unlike most global objects, <code>Reflect</code> is not a constructor. You can not use it with a <a href="/en-US/docs/Web/JavaScript/Reference/Operators/new"><code>new</code> operator</a> or invoke the <code>Reflect</code> object as a function. All properties and methods of <code>Reflect</code> are static (just like the {{jsxref("Math")}} object).</p>
+
+<h2 id="方法">方法</h2>
+
+<p>The <code>Reflect</code> object provides the following static functions which have the same names as the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler">proxy handler methods</a>. Some of these methods are the same as corresponding methods on {{jsxref("Object")}}.</p>
+
+<dl>
+ <dt>{{jsxref("Reflect.apply()")}}</dt>
+ <dd>Calls a target function with arguments as specified by the <code>args</code> parameter. See also {{jsxref("Function.prototype.apply()")}}.</dd>
+ <dt>{{jsxref("Reflect.construct()")}}</dt>
+ <dd> The <a href="/en-US/docs/Web/JavaScript/Reference/Operators/new"><code>new</code> operator</a> as a function. Equivalent to calling <code>new target(...args)</code>.</dd>
+ <dt>{{jsxref("Reflect.defineProperty()")}}</dt>
+ <dd>Similar to {{jsxref("Object.defineProperty()")}}. Returns a {{jsxref("Boolean")}}.</dd>
+ <dt>{{jsxref("Reflect.deleteProperty()")}}</dt>
+ <dd>The <a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete"><code>delete</code> operator</a> as a function. Equivalent to calling <code>delete target[name]</code>.</dd>
+ <dt>{{jsxref("Reflect.get()")}}</dt>
+ <dd>A function that returns the value of properties.</dd>
+ <dt>{{jsxref("Reflect.getOwnPropertyDescriptor()")}}</dt>
+ <dd>Similar to {{jsxref("Object.getOwnPropertyDescriptor()")}}. Returns a property descriptor of the given property if it exists on the object,  {{jsxref("undefined")}} otherwise.</dd>
+ <dt>{{jsxref("Reflect.getPrototypeOf()")}}</dt>
+ <dd>Same as {{jsxref("Object.getPrototypeOf()")}}.</dd>
+ <dt>{{jsxref("Reflect.has()")}}</dt>
+ <dd>The <a href="/en-US/docs/Web/JavaScript/Reference/Operators/in"><code>in</code> operator</a> as function. Returns a boolean indicating whether an own or inherited property exists.</dd>
+ <dt>{{jsxref("Reflect.isExtensible()")}}</dt>
+ <dd>Same as {{jsxref("Object.isExtensible()")}}.</dd>
+ <dt>{{jsxref("Reflect.ownKeys()")}}</dt>
+ <dd>Returns an array of the target object's own (not inherited) property keys.</dd>
+ <dt>{{jsxref("Reflect.preventExtensions()")}}</dt>
+ <dd>Similar to {{jsxref("Object.preventExtensions()")}}. Returns a {{jsxref("Boolean")}}.</dd>
+ <dt>{{jsxref("Reflect.set()")}}</dt>
+ <dd>A function that assigns values to properties. Returns a {{jsxref("Boolean")}} that is <code>true</code> if the update was successful.</dd>
+ <dt>{{jsxref("Reflect.setPrototypeOf()")}}</dt>
+ <dd>A function that sets the prototype of an object.</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-reflect-object', 'Reflect')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-reflect-object', 'Reflect')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Reflect.enumerate has been removed.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(49.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("42")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(49.0)}}</td>
+ <td>{{CompatChrome(49.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("42")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>The {{jsxref("Proxy")}} global object.</li>
+ <li>The {{jsxref("Proxy.handler", "handler")}} object.</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/regexp/index.html b/files/zh-tw/web/javascript/reference/global_objects/regexp/index.html
new file mode 100644
index 0000000000..7bf77316e2
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/regexp/index.html
@@ -0,0 +1,269 @@
+---
+title: RegExp
+slug: Web/JavaScript/Reference/Global_Objects/RegExp
+translation_of: Web/JavaScript/Reference/Global_Objects/RegExp
+---
+<div>{{JSRef}}</div>
+
+<div></div>
+
+<p><strong><code>RegExp</code></strong> 物件被用來比對符合自訂規則的文字。</p>
+
+<p>關於正規表達式(regular expressions)的介紹,可以閱讀 <a href="/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions">JavaScript 指南</a>中的 <a href="/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions">正規表達式章節</a>。</p>
+
+<h2 id="說明">說明</h2>
+
+<p>建立 <code>RegExp</code> 物件有兩種方式:<em>文字表示法 (literal notation)</em> 和 <em>建構子 (constructor)。</em></p>
+
+<ul>
+ <li><strong>文字表示法</strong> 的參數,頭尾以斜線標註,且不使用引號標註。</li>
+ <li><strong>建構子函式</strong> 的參數,頭尾不以斜線標註,但使用引號標註。</li>
+</ul>
+
+<p>以下的表達式會建立出相同的正規表達式:</p>
+
+<pre class="brush: js">/ab+c/i
+new RegExp(/ab+c/, 'i') // literal notation
+new RegExp('ab+c', 'i') // constructor
+</pre>
+
+<p>The literal notation provides a compilation of the regular expression when the expression is evaluated. Use literal notation when the regular expression will remain constant. For example, if you use literal notation to construct a regular expression used in a loop, the regular expression won't be recompiled on each iteration.</p>
+
+<p>The constructor of the regular expression object—for example, <code>new RegExp('ab+c')</code>—provides runtime compilation of the regular expression. Use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input.</p>
+
+<p>Starting with ECMAScript 6, <code>new RegExp(/ab+c/, 'i')</code> no longer throws a {{jsxref("TypeError")}} ("can't supply flags when constructing one RegExp from another") when the first argument is a <code>RegExp</code> and the second <code><var>flags</var></code> argument is present. A new <code>RegExp</code> from the arguments is created instead.</p>
+
+<p>When using the constructor function, the normal string escape rules (preceding special characters with <code>\</code> when included in a string) are necessary.</p>
+
+<p>For example, the following are equivalent:</p>
+
+<pre class="brush: js">let re = /\w+/
+let re = new RegExp('\\w+')
+</pre>
+
+<h2 id="Constructor">Constructor</h2>
+
+<dl>
+ <dt><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp">RegExp()</a></code></dt>
+ <dd>Creates a regular expression object.</dd>
+</dl>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt><code>RegExp.prototype</code></dt>
+ <dd>Allows the addition of properties to all objects.</dd>
+ <dt><code>RegExp.length</code></dt>
+ <dd>The value of <code>RegExp.length</code> is <code>2</code>.</dd>
+ <dt>{{jsxref("RegExp.@@species", "get RegExp[@@species]")}}</dt>
+ <dd>The constructor function that is used to create derived objects.</dd>
+ <dt>{{jsxref("RegExp.lastIndex")}}</dt>
+ <dd>The index at which to start the next match.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p>The global <code>RegExp</code> object has no methods of its own. However, it does inherit some methods through the prototype chain.</p>
+
+<h2 id="RegExp_prototype_objects_and_instances"><code>RegExp</code> prototype objects and instances</h2>
+
+<h3 id="Properties_2">Properties</h3>
+
+<div>
+<p>See also <a href="/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#RegExp_Properties">deprecated <code>RegExp</code> properties.</a></p>
+
+<p>Note that several of the {{JSxRef("RegExp")}} properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.</p>
+
+<dl>
+ <dt><code>RegExp.prototype.constructor</code></dt>
+ <dd>Specifies the function that creates an object's prototype.</dd>
+ <dt>{{JSxRef("RegExp.prototype.flags")}}</dt>
+ <dd>A string that contains the flags of the <code>RegExp</code> object.</dd>
+ <dt>{{JSxRef("RegExp.prototype.dotAll")}}</dt>
+ <dd>Whether <code>.</code> matches newlines or not.</dd>
+ <dt>{{JSxRef("RegExp.prototype.global")}}</dt>
+ <dd>Whether to test the regular expression against all possible matches in a string, or only against the first.</dd>
+ <dt>{{JSxRef("RegExp.prototype.ignoreCase")}}</dt>
+ <dd>Whether to ignore case while attempting a match in a string.</dd>
+ <dt>{{JSxRef("RegExp.prototype.multiline")}}</dt>
+ <dd>Whether or not to search in strings across multiple lines.</dd>
+ <dt>{{JSxRef("RegExp.prototype.source")}}</dt>
+ <dd>The text of the pattern.</dd>
+ <dt>{{JSxRef("RegExp.prototype.sticky")}}</dt>
+ <dd>Whether or not the search is sticky.</dd>
+ <dt>{{JSxRef("RegExp.prototype.unicode")}}</dt>
+ <dd>Whether or not Unicode features are enabled.</dd>
+</dl>
+</div>
+
+<h3 id="Methods_2">Methods</h3>
+
+<div>
+<dl>
+ <dt>{{JSxRef("RegExp.prototype.compile()")}}</dt>
+ <dd>(Re-)compiles a regular expression during execution of a script.</dd>
+ <dt>{{JSxRef("RegExp.prototype.exec()")}}</dt>
+ <dd>Executes a search for a match in its string parameter.</dd>
+ <dt>{{JSxRef("RegExp.prototype.test()")}}</dt>
+ <dd>Tests for a match in its string parameter.</dd>
+ <dt>{{JSxRef("RegExp.prototype.@@match()", "RegExp.prototype[@@match]()")}}</dt>
+ <dd>Performs match to given string and returns match result.</dd>
+ <dt>{{JSxRef("RegExp.prototype.@@matchAll()", "RegExp.prototype[@@matchAll]()")}}</dt>
+ <dd>Returns all matches of the regular expression against a string.</dd>
+ <dt>{{JSxRef("RegExp.prototype.@@replace()", "RegExp.prototype[@@replace]()")}}</dt>
+ <dd>Replaces matches in given string with new substring.</dd>
+ <dt>{{JSxRef("RegExp.prototype.@@search()", "RegExp.prototype[@@search]()")}}</dt>
+ <dd>Searches the match in given string and returns the index the pattern found in the string.</dd>
+ <dt>{{JSxRef("RegExp.prototype.@@split()", "RegExp.prototype[@@split]()")}}</dt>
+ <dd>Splits given string into an array by separating the string into substring.</dd>
+ <dt>{{JSxRef("RegExp.prototype.toSource()")}}</dt>
+ <dd>Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the {{JSxRef("Object.prototype.toSource()")}} method.</dd>
+ <dt>{{JSxRef("RegExp.prototype.toString()")}}</dt>
+ <dd>Returns a string representing the specified object. Overrides the {{JSxRef("Object.prototype.toString()")}} method.</dd>
+</dl>
+</div>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Using_a_regular_expression_to_change_data_format">Using a regular expression to change data format</h3>
+
+<p>The following script uses the {{jsxref("String.prototype.replace()", "replace()")}} method of the {{jsxref("Global_Objects/String", "String")}} instance to match a name in the format <em>first last</em> and output it in the format <em>last, first</em>.</p>
+
+<p>In the replacement text, the script uses <code>$1</code> and <code>$2</code> to indicate the results of the corresponding matching parentheses in the regular expression pattern.</p>
+
+<pre class="brush: js">let re = /(\w+)\s(\w+)/
+let str = 'John Smith'
+let newstr = str.replace(re, '$2, $1')
+console.log(newstr)
+</pre>
+
+<p>This displays <code>"Smith, John"</code>.</p>
+
+<h3 id="Using_regular_expression_to_split_lines_with_different_line_endingsends_of_lineline_breaks">Using regular expression to split lines with different <strong>line endings/ends of line/line breaks</strong></h3>
+
+<p>The default line ending varies depending on the platform (Unix, Windows, etc.). The line splitting provided in this example works on all platforms.</p>
+
+<pre class="brush: js">let text = 'Some text\nAnd some more\r\nAnd yet\rThis is the end'
+let lines = text.split(/\r\n|\r|\n/)
+console.log(lines) // logs [ 'Some text', 'And some more', 'And yet', 'This is the end' ]
+</pre>
+
+<p>Note that the order of the patterns in the regular expression matters.</p>
+
+<h3 id="Using_regular_expression_on_multiple_lines">Using regular expression on multiple lines</h3>
+
+<pre class="brush: js">let s = 'Please yes\nmake my day!'
+
+s.match(/yes.*day/);
+// Returns null
+
+s.match(/yes[^]*day/);
+// Returns ["yes\nmake my day"]
+</pre>
+
+<h3 id="Using_a_regular_expression_with_the_sticky_flag">Using a regular expression with the sticky flag</h3>
+
+<p>The <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky">sticky flag</a> indicates that the regular expression performs sticky matching in the target string by attempting to match starting at {{jsxref("RegExp.prototype.lastIndex")}}.</p>
+
+<pre class="brush: js">let str = '#foo#'
+let regex = /foo/y
+
+regex.lastIndex = 1
+regex.test(str) // true
+regex.lastIndex = 5
+regex.test(str) // false (lastIndex is taken into account with sticky flag)
+regex.lastIndex // 0 (reset after match failure)</pre>
+
+<h3 id="The_difference_between_the_sticky_flag_and_the_global_flag">The difference between the sticky flag and the global flag</h3>
+
+<p>With the sticky flag y, the next match has to happen at the lastIndex position, while with the global flag g, the match can happen at the lastIndex position or later:</p>
+
+<pre class="brush: js">re = /\d/y;
+while (r = re.exec("123 456")) console.log(r, "AND re.lastIndex", re.lastIndex);
+
+// [ '1', index: 0, input: '123 456', groups: undefined ] AND re.lastIndex 1
+// [ '2', index: 1, input: '123 456', groups: undefined ] AND re.lastIndex 2
+// [ '3', index: 2, input: '123 456', groups: undefined ] AND re.lastIndex 3
+// ... and no more match.</pre>
+
+<p>With the global flag g, all 6 digits would be matched, not just 3.</p>
+
+<h3 id="Regular_expression_and_Unicode_characters">Regular expression and Unicode characters</h3>
+
+<p>As mentioned above, <code>\w</code> or <code>\W</code> only matches ASCII based characters; for example, <code>a</code> to <code>z</code>, <code>A</code> to <code>Z</code>, <code>0</code> to <code>9</code>, and <code>_</code>.</p>
+
+<p>To match characters from other languages such as Cyrillic or Hebrew, use <code>\u<var>hhhh</var></code>, where <code><var>hhhh</var></code> is the character's Unicode value in hexadecimal.</p>
+
+<p>This example demonstrates how one can separate out Unicode characters from a word.</p>
+
+<pre class="brush: js">let text = 'Образец text на русском языке'
+let regex = /[\u0400-\u04FF]+/g
+
+let match = regex.exec(text)
+console.log(match[0]) // logs 'Образец'
+console.log(regex.lastIndex) // logs '7'
+
+let match2 = regex.exec(text)
+console.log(match2[0]) // logs 'на' [did not log 'text']
+console.log(regex.lastIndex) // logs '15'
+
+// and so on
+</pre>
+
+<p>The <a href="/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes">Unicode property escapes</a> feature introduces a solution, by allowing for a statement as simple as <code>\p{scx=Cyrl}</code>. One can also use an external resource for getting the complete Unicode block range for different scripts, such as <a href="http://kourge.net/projects/regexp-unicode-block">Regexp-Unicode-block</a>.</p>
+
+<h3 id="Extracting_sub-domain_name_from_URL">Extracting sub-domain name from URL</h3>
+
+<pre class="brush: js">let url = 'http://xxx.domain.com'
+console.log(/[^.]+/.exec(url)[0].substr(7)) // logs 'xxx'
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-regexp-regular-expression-objects', 'RegExp')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.RegExp")}}</p>
+</div>
+
+<h3 id="Firefox-specific_notes">Firefox-specific notes</h3>
+
+<p>Starting with Firefox 34, in the case of a capturing group with quantifiers preventing its exercise, the matched text for a capturing group is now <code>undefined</code> instead of an empty string:</p>
+
+<pre class="brush: js">// Firefox 33 or older
+'x'.replace(/x(.)?/g, function(m, group) {
+ console.log("'group:" + group + "'");
+});
+// 'group:'
+
+// Firefox 34 or newer
+'x'.replace(/x(.)?/g, function(m, group) {
+ console.log("'group:" + group + "'");
+});
+// 'group:undefined'
+</pre>
+
+<p>Note that due to web compatibility, <code>RegExp.$N</code> will still return an empty string instead of <code>undefined</code> (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1053944">bug 1053944</a>).</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">Regular Expressions</a> chapter in the <a href="/en-US/docs/Web/JavaScript/Guide">JavaScript Guide</a></li>
+ <li>{{jsxref("String.prototype.match()")}}</li>
+ <li>{{jsxref("String.prototype.replace()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/add/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/add/index.html
new file mode 100644
index 0000000000..b0a85a0a06
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/add/index.html
@@ -0,0 +1,83 @@
+---
+title: Set.prototype.add()
+slug: Web/JavaScript/Reference/Global_Objects/Set/add
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 參考
+ - 方法
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/add
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>add()</strong></code> 會在一個 <code>Set</code> 物件的尾端加上一個指定 <code>value</code> 的新元素。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-add.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>mySet</em>.add(<em>value</em>);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>要被加到 <code>Set</code> 物件中的值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p><code>Set</code> 物件本身。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_add_方法">使用 <code>add</code> 方法</h3>
+
+<pre class="brush: js">var mySet = new Set();
+
+mySet.add(1);
+mySet.add(5).add('some text'); // chainable
+
+console.log(mySet);
+// Set [1, 5, "some text"]
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.add', 'Set.prototype.add')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.add', 'Set.prototype.add')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.add")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("Set.prototype.delete()")}}</li>
+ <li>{{jsxref("Set.prototype.has()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/clear/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/clear/index.html
new file mode 100644
index 0000000000..2eb8875c34
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/clear/index.html
@@ -0,0 +1,79 @@
+---
+title: Set.prototype.clear()
+slug: Web/JavaScript/Reference/Global_Objects/Set/clear
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 參考
+ - 方法
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/clear
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>clear()</strong></code> 方法會從一個 <code>Set</code> 物件中移除其所有元素。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-clear.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>mySet</em>.clear();</pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>{{jsxref("undefined")}}.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_clear_方法">使用 <code>clear</code> 方法</h3>
+
+<pre class="brush: js">var mySet = new Set();
+mySet.add(1);
+mySet.add('foo');
+
+mySet.size; // 2
+mySet.has('foo'); // true
+
+mySet.clear();
+
+mySet.size; // 0
+mySet.has('bar') // false
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.clear', 'Set.prototype.clear')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.clear', 'Set.prototype.clear')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.clear")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("Set.prototype.delete()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/delete/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/delete/index.html
new file mode 100644
index 0000000000..d465f45bef
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/delete/index.html
@@ -0,0 +1,98 @@
+---
+title: Set.prototype.delete()
+slug: Web/JavaScript/Reference/Global_Objects/Set/delete
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 參考
+ - 方法
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/delete
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>delete()</strong></code> 方法會一個 <code>Set</code> 物件中移除指定元素。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-delete.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>mySet</em>.delete(<em>value</em>);</pre>
+
+<h3 id="參數'">參數'</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>要從 <code>Set</code> 物件中移除的值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p><code>true</code> 如果成功從 <code>Set</code> 物件中移除;反之 <code>false</code>。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_delete_方法">使用 <code>delete</code> 方法</h3>
+
+<pre class="brush: js">var mySet = new Set();
+mySet.add('foo');
+
+mySet.delete('bar'); // Returns false. No "bar" element found to be deleted.
+mySet.delete('foo'); // Returns true. Successfully removed.
+
+mySet.has('foo'); // Returns false. The "foo" element is no longer present.
+</pre>
+
+<p>下方展示了如何從一個 Set 中移除物件。</p>
+
+<pre class="brush: js">var setObj = new Set(); // Create a New Set.
+
+setObj.add({x: 10, y: 20}); // Add object in the set.
+
+setObj.add({x: 20, y: 30}); // Add object in the set.
+
+// Delete any point with `x &gt; 10`.
+setObj.forEach(function(point){
+ if(point.x &gt; 10){
+ setObj.delete(point)
+ }
+})
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.delete', 'Set.prototype.delete')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.delete', 'Set.prototype.delete')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.delete")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("Set.prototype.clear()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/entries/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/entries/index.html
new file mode 100644
index 0000000000..6bf609afb2
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/entries/index.html
@@ -0,0 +1,78 @@
+---
+title: Set.prototype.entries()
+slug: Web/JavaScript/Reference/Global_Objects/Set/entries
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 方法
+ - 迭代器
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/entries
+---
+<div>{{JSRef}}</div>
+
+<div><code><strong>entries()</strong></code> 方法回傳一個 <code>Iterator</code> 物件,其包含著一個由插入順序排序,<code>Set</code> 物件中每個元素的<strong> <code>[value, value]</code></strong> 陣列。儘管對 <code>Set</code> 物件來說沒有像 <code>Map</code> 一樣的 <code>key</code> 概念,為了確保這個 API 運作的與 <code>Map</code> 相似,每個 <em>entry</em> 都有同樣的值同時作為其 <em>key</em> 和 <em>value</em> ,因此回傳的是一個<strong><code>[value, value]</code></strong> 的陣列。</div>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-entries.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><em>mySet</em>.entries()</code></pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 <code>Iterator</code> 物件,包含著一個由插入順序排序,<code>Set</code> 物件中每個元素的<strong> <code>[value, value]</code></strong> 陣列。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_entries()">使用 <code>entries()</code></h3>
+
+<pre class="brush:js">var mySet = new Set();
+mySet.add('foobar');
+mySet.add(1);
+mySet.add('baz');
+
+var setIter = mySet.entries();
+
+console.log(setIter.next().value); // ["foobar", "foobar"]
+console.log(setIter.next().value); // [1, 1]
+console.log(setIter.next().value); // ["baz", "baz"]
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.entries', 'Set.prototype.entries')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.entries', 'Set.prototype.entries')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.entries")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set.prototype.keys()")}}</li>
+ <li>{{jsxref("Set.prototype.values()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html
new file mode 100644
index 0000000000..c77d2ea99b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/has/index.html
@@ -0,0 +1,92 @@
+---
+title: Set.prototype.has()
+slug: Web/JavaScript/Reference/Global_Objects/Set/has
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 方法
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/has
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>has()</strong></code> 方法對一個指定值元素在 <code>Set</code> 物件中的存在與否回傳一個布林值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-has.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>mySet</em>.has(<em>value</em>);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>value</code></dt>
+ <dd>要測試是否存在在 <code>Set</code> 中的值。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>回傳 <code>true</code> 如果給定值存在在 <code>Set</code> 物件中;反之回傳 <code>false</code> 。</p>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> 技術上來說,<code>has()</code> 使用了 <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality">sameValueZero</a></code> 算法來判斷給定元素的存在與否。</p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_has_方法">使用 <code>has</code> 方法</h3>
+
+<pre class="brush: js">var mySet = new Set();
+mySet.add('foo');
+
+mySet.has('foo'); // returns true
+mySet.has('bar'); // returns false
+
+var set1 = new Set();
+var obj1 = {'key1': 1};
+set1.add(obj1);
+
+set1.has(obj1); // returns true
+set1.has({'key1': 1}); // returns false because they are different object references
+set1.add({'key1': 1}); // now set1 contains 2 entries
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.has', 'Set.prototype.has')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.has', 'Set.prototype.has')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.has")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set")}}</li>
+ <li>{{jsxref("Set.prototype.add()")}}</li>
+ <li>{{jsxref("Set.prototype.delete()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/index.html
new file mode 100644
index 0000000000..2b3f80fdd1
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/index.html
@@ -0,0 +1,243 @@
+---
+title: Set
+slug: Web/JavaScript/Reference/Global_Objects/Set
+tags:
+ - ECMAScript 2015
+ - Global Objects
+ - JavaScript
+ - Object
+ - set
+translation_of: Web/JavaScript/Reference/Global_Objects/Set
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Set</code></strong> 物件可讓你儲存任何類型的唯一值(unique),不論是{{Glossary("Primitive", "基本型別(primitive)值")}}或物件參考(references)。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-constructor.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">new Set([<em>iterable</em>]);</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>iterable</code></dt>
+ <dd>若一個<a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of">可迭代物件</a>被傳入,其所有的元素將會被加入至新的 <code>Set</code>。若你沒有指定此參數,或參數值為 <code>null</code>,則新的 <code>Set</code> 會是空的。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個新的 <code>Set</code> 物件。</p>
+
+<h2 id="描述">描述</h2>
+
+<p><code>Set</code> 對象是數值的收集器。您可以按插入順序迭代收集器中的元素。在 <code>Set</code> 裡的元素只會出現一次<strong>;</strong> 意即在<code>Set</code>裡的元素都是獨一無二</p>
+
+<h3 id="值的相等性">值的相等性</h3>
+
+<p>因為在 Set 裡每個值都是獨立的,所以都會檢查值的相等性。在早期的ECMAScript規範版本中,此處算法跟基於===操作符中使用的算法並不相同。具體來說,在 <code>Set</code>裡+0(在嚴格模式是和-0相等)和-0是不同的值。然而在 ECMAScript 2015規範中這點已被更改。請參閱 <a href="#Browser_compatibility">瀏覽器兼容性</a> 中的"Value equality for -0 and 0"。</p>
+
+<p>另外,NaN和undefined都可以被放置在Set 中, NaN之間被視為相同的值(儘管 NaN !== NaN)。</p>
+
+<dl>
+ <dt><code>Set.length</code></dt>
+ <dd>The value of the <code>length</code> property is 0.</dd>
+ <dt>{{jsxref("Set.@@species", "get Set[@@species]")}}</dt>
+ <dd>The constructor function that is used to create derived objects.</dd>
+ <dt>{{jsxref("Set.prototype")}}</dt>
+ <dd>Represents the prototype for the <code>Set</code> constructor. Allows the addition of properties to all <code>Set</code> objects.</dd>
+</dl>
+
+<h2 id="Set_物件實體"><code>Set</code> 物件實體</h2>
+
+<p>All <code>Set</code> instances inherit from {{jsxref("Set.prototype")}}.</p>
+
+<h3 id="屬性">屬性</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/Set/prototype','Properties')}}</p>
+
+<h3 id="方法">方法</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/Set/prototype','Methods')}}</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_Set_物件">使用 <code>Set</code> 物件</h3>
+
+<pre class="brush: js notranslate">var mySet = new Set();
+
+mySet.add(1); // Set [ 1 ]
+mySet.add(5); // Set [ 1, 5 ]
+mySet.add(5); // Set [ 1, 5 ]
+mySet.add('some text'); // Set [ 1, 5, 'some text' ]
+var o = {a: 1, b: 2};
+mySet.add(o);
+
+mySet.add({a: 1, b: 2}); // o is referencing a different object so this is okay
+
+mySet.has(1); // true
+mySet.has(3); // false, 3 has not been added to the set
+mySet.has(5); // true
+mySet.has(Math.sqrt(25)); // true
+mySet.has('Some Text'.toLowerCase()); // true
+mySet.has(o); // true
+
+mySet.size; // 5
+
+mySet.delete(5); // removes 5 from the set
+mySet.has(5); // false, 5 has been removed
+
+mySet.size; // 4, we just removed one value
+console.log(mySet);// Set [ 1, "some text", Object {a: 1, b: 2}, Object {a: 1, b: 2} ]</pre>
+
+<h3 id="迭代_Sets">迭代 Sets</h3>
+
+<pre class="brush: js notranslate">// iterate over items in set
+// logs the items in the order: 1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}
+for (let item of mySet) console.log(item);
+
+// logs the items in the order: 1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}
+for (let item of mySet.keys()) console.log(item);
+
+// logs the items in the order: 1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}
+for (let item of mySet.values()) console.log(item);
+
+// logs the items in the order: 1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}
+//(key and value are the same here)
+for (let [key, value] of mySet.entries()) console.log(key);
+
+// convert Set object to an Array object, with <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from">Array.from</a>
+var myArr = Array.from(mySet); // [1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}]
+
+// the following will also work if run in an HTML document
+mySet.add(document.body);
+mySet.has(document.querySelector('body')); // true
+
+// converting between Set and Array
+mySet2 = new Set([1, 2, 3, 4]);
+mySet2.size; // 4
+[...mySet2]; // [1, 2, 3, 4]
+
+// intersect can be simulated via
+var intersection = new Set([...set1].filter(x =&gt; set2.has(x)));
+
+// difference can be simulated via
+var difference = new Set([...set1].filter(x =&gt; !set2.has(x)));
+
+// Iterate set entries with forEach
+mySet.forEach(function(value) {
+ console.log(value);
+});
+
+// 1
+// 2
+// 3
+// 4</pre>
+
+<h3 id="實作基本的_set_操作">實作基本的 set 操作</h3>
+
+<pre class="brush: js notranslate">Set.prototype.isSuperset = function(subset) {
+ for (var elem of subset) {
+ if (!this.has(elem)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+Set.prototype.union = function(setB) {
+ var union = new Set(this);
+ for (var elem of setB) {
+ union.add(elem);
+ }
+ return union;
+}
+
+Set.prototype.intersection = function(setB) {
+ var intersection = new Set();
+ for (var elem of setB) {
+ if (this.has(elem)) {
+ intersection.add(elem);
+ }
+ }
+ return intersection;
+}
+
+Set.prototype.difference = function(setB) {
+ var difference = new Set(this);
+ for (var elem of setB) {
+ difference.delete(elem);
+ }
+ return difference;
+}
+
+//Examples
+var setA = new Set([1, 2, 3, 4]),
+ setB = new Set([2, 3]),
+ setC = new Set([3, 4, 5, 6]);
+
+setA.isSuperset(setB); // =&gt; true
+setA.union(setC); // =&gt; Set [1, 2, 3, 4, 5, 6]
+setA.intersection(setC); // =&gt; Set [3, 4]
+setA.difference(setC); // =&gt; Set [1, 2]
+
+</pre>
+
+<h3 id="與_Array_物件關聯">與 <code>Array</code> 物件關聯</h3>
+
+<pre class="brush: js notranslate">var myArray = ['value1', 'value2', 'value3'];
+
+// Use the regular Set constructor to transform an Array into a Set
+var mySet = new Set(myArray);
+
+mySet.has('value1'); // returns true
+
+// Use the spread operator to transform a set into an Array.
+console.log([...mySet]); // Will show you exactly the same Array as myArray</pre>
+
+<h3 id="與_Strings_關聯">與 <code>Strings</code> 關聯</h3>
+
+<pre class="brush: js notranslate">var text = 'India';
+
+var mySet = new Set(text); // Set ['I', 'n', 'd', 'i', 'a']
+mySet.size; // 5
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set-objects', 'Set')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set-objects', 'Set')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Map")}}</li>
+ <li>{{jsxref("WeakMap")}}</li>
+ <li>{{jsxref("WeakSet")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/set/values/index.html b/files/zh-tw/web/javascript/reference/global_objects/set/values/index.html
new file mode 100644
index 0000000000..bb136ba806
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/set/values/index.html
@@ -0,0 +1,79 @@
+---
+title: Set.prototype.values()
+slug: Web/JavaScript/Reference/Global_Objects/Set/values
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - 原型
+ - 方法
+ - 迭代器
+ - 集合
+translation_of: Web/JavaScript/Reference/Global_Objects/Set/values
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>values()</strong></code> 方法回傳一個 <code>Iterator</code> 物件,包含著 <code>Set</code> 物件中所有元素,由插入順序排序。</p>
+
+<p><strong><code>keys()</code></strong> 是這個方法的替身 (為了與 {{jsxref("Map")}} 物件保持相似性);他運行的完全一模一樣,回傳 <code>Set</code> 中元素的 <strong>values</strong> 。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/set-prototype-values.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code><em>mySet</em>.values();
+</code></pre>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>一個 <code>Iterator</code> 物件,包含著 <code>Set</code> 物件中所有元素,由插入順序排序。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_values()">使用 <code>values()</code></h3>
+
+<pre class="brush:js">var mySet = new Set();
+mySet.add('foo');
+mySet.add('bar');
+mySet.add('baz');
+
+var setIter = mySet.values();
+
+console.log(setIter.next().value); // "foo"
+console.log(setIter.next().value); // "bar"
+console.log(setIter.next().value); // "baz"</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-set.prototype.values', 'Set.prototype.values')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-set.prototype.values', 'Set.prototype.values')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.Set.values")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Set.prototype.entries()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/index.html
new file mode 100644
index 0000000000..ad4474693a
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/index.html
@@ -0,0 +1,328 @@
+---
+title: 字串
+slug: Web/JavaScript/Reference/Global_Objects/String
+tags:
+ - ECMAScript 2015
+ - JavaScript
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String
+---
+<p>{{JSRef("Global_Objects", "String")}}</p>
+
+<p><strong><code>String</code></strong> 全域物件為字串的構造函數,或是一個字符序列。</p>
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<p>字串文字採用下列形式:</p>
+
+<pre>'string text' "string text" "中文 español deutsch English हिन्दी العربية português বাংলা русский 日本語 ਪੰਜਾਬੀ 한국어 தமிழ் עברית"</pre>
+
+<p>字串也可以被全域的 <code>String</code> 物件建立:</p>
+
+<pre>String(thing)</pre>
+
+<h3 id="Parameters" name="Parameters">參數</h3>
+
+<dl>
+ <dt><code>thing</code></dt>
+ <dd>任何要轉換成字串的物件。</dd>
+</dl>
+
+<h3 id="樣板字面值">樣板字面值</h3>
+
+<p>自 ECMAScript 2015,字串文字也可以是<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Template_literals">樣板字面值(Template literals)</a>:</p>
+
+<pre>`hello world` `hello! world!` `hello ${who}` escape `&lt;a&gt;${who}&lt;/a&gt;`</pre>
+
+<h3 id="跳脫符號">跳脫符號</h3>
+
+<p>除了常規的、可印出來的字元,特殊字元也可以被跳脫符號來表示編碼。</p>
+
+<table>
+ <thead>
+ <tr>
+ <th scope="col">代碼</th>
+ <th scope="col">輸出</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>\0</code></td>
+ <td>空字元</td>
+ </tr>
+ <tr>
+ <td><code>\'</code></td>
+ <td>單引號</td>
+ </tr>
+ <tr>
+ <td><code>\"</code></td>
+ <td>雙引號</td>
+ </tr>
+ <tr>
+ <td><code>\\</code></td>
+ <td>反斜線</td>
+ </tr>
+ <tr>
+ <td><code>\n</code></td>
+ <td>斷行</td>
+ </tr>
+ <tr>
+ <td><code>\r</code></td>
+ <td>回車</td>
+ </tr>
+ <tr>
+ <td><code>\v</code></td>
+ <td>垂直制表</td>
+ </tr>
+ <tr>
+ <td><code>\t</code></td>
+ <td>制表</td>
+ </tr>
+ <tr>
+ <td><code>\b</code></td>
+ <td>退格</td>
+ </tr>
+ <tr>
+ <td><code>\f</code></td>
+ <td>饋頁</td>
+ </tr>
+ <tr>
+ <td><code>\uXXXX</code></td>
+ <td>unicode 代碼</td>
+ </tr>
+ <tr>
+ <td><code>\u{X}</code> ... <code>\u{XXXXXX}</code></td>
+ <td>unicode 代碼 {{experimental_inline}}</td>
+ </tr>
+ <tr>
+ <td><code>\xXX</code></td>
+ <td>Latin-1 字元</td>
+ </tr>
+ </tbody>
+</table>
+
+<dl>
+</dl>
+
+<div class="note">
+<p>和其他語言不同,JavaScript 將單引號字串和雙引號字串是做相同;因此,上述的序列可以在單引號或雙引號中作用。</p>
+</div>
+
+<dl>
+</dl>
+
+<h3 id="長字面值字串">長字面值字串</h3>
+
+<p>有些時候,你的程式碼會包含非常長的字串。 為了不讓長字串無止盡地往下長,抑或是在你心血來潮的時候,你可能希望將這樣長的字串能夠斷成多行卻不影響到實際的內容。</p>
+
+<p>你可以用 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition_()">+</a> 運算子附加多個字串在一起,像是這樣:</p>
+
+<pre><code>let longString = "This is a very long string which needs " +
+ "to wrap across multiple lines because " +
+ "otherwise my code is unreadable.";</code></pre>
+
+<p>或者,你可以在每一行尾端用反斜線字元("\")表示字串會繼續被顯示在下一列。 你必須要確定在反斜線後面沒有任何空白或其他字元,甚至是縮排;否則這個方法將失效。 這個形式看起來像這樣:</p>
+
+<pre><code>let longString = "This is a very long string which needs \
+to wrap across multiple lines because \
+otherwise my code is unreadable.";</code></pre>
+
+<p>這兩個方法都會建立相同的字串內容。</p>
+
+<h2 id="Description" name="Description">說明</h2>
+
+<p>字串對於能保留以文字形式表達的資料這件事來說,是有用的。在字串上,一些最常被使用的運算即確認字串長度 {{jsxref("String.length", "length")}} ,用 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/String_Operators">+ 或 += 字串運算元</a> 建造或者串接字串,用 {{jsxref("String.indexOf", "indexOf")}} 方法檢查?子字串是否存在或子字串的位置,或者是用 {{jsxref("String.substring", "substring")}} 方法將子字串抽取出來。</p>
+
+<h3 id="Character_access" name="Character_access">存取字元</h3>
+
+<p>有兩個方法可以存取字串中個別的字元。第一個是用 {{jsxref("String.charAt", "charAt")}} 方法:</p>
+
+<pre class="brush: js">return 'cat'.charAt(1); // 回傳 "a"
+</pre>
+
+<p>另一個(在ECMAScript 5中被提到)方法是將字串當作一個類似陣列的物件,直接存取字串中對應的數值索引。</p>
+
+<pre class="brush: js">return 'cat'[1]; // 回傳 "a"
+</pre>
+
+<p>對於存取字元使用的括號表達式,沒辦法去刪除或指派一個值給這些屬性。 這些屬性既非可寫的,也非可設定的。(參見 {{jsxref("Object.defineProperty")}})</p>
+
+<h3 id="Comparing_strings" name="Comparing_strings">比較字串</h3>
+
+<p>C 語言的開發者有 <code>strcmp()</code> 函式可以用來比較字串。 在 JavaScript 中,你只能用<a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">小於和大於運算子</a>:</p>
+
+<pre class="brush: js">var a = "a";
+var b = "b";
+if (a &lt; b) // true
+ print(a + " 小於 " + b);
+else if (a &gt; b)
+ print(a + " 大於 " + b);
+else
+ print(a + " 和 " + b + " 相等");
+</pre>
+
+<p>這樣類似的結果,也能使用繼承 <code>String</code> 實體的 {{jsxref("String.localeCompare", "localeCompare")}} 方法來實現。</p>
+
+<h3 id="分辨_string_原始型別和_String_物件">分辨 string 原始型別和 <code>String</code> 物件</h3>
+
+<p>請注意,JavaScript 會區別 <code>String</code> 物件和原始字串({{jsxref("Global_Objects/Boolean", "Boolean")}} 和 {{jsxref("Global_Objects/Number", "Numbers")}} 也是如此)。</p>
+
+<p>String literals (denoted by double or single quotes) and strings returned from <code>String</code> calls in a non-constructor context (i.e., without using the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/new"><code>new</code> keyword</a>) are primitive strings. JavaScript automatically converts primitives to <code>String</code> objects, so that it's possible to use <code>String</code> object methods for primitive strings. In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the string primitive and call the method or perform the property lookup.</p>
+
+<pre class="brush: js">var s_prim = "foo";
+var s_obj = new String(s_prim);
+
+console.log(typeof s_prim); // 印出 "string"
+console.log(typeof s_obj); // 印出 "object"
+</pre>
+
+<p>字串原始型別和 <code>String</code> 物件也會在使用 {{jsxref("Global_Objects/eval", "eval")}} 時給出不同的結果。 原始型別傳進 <code>eval</code> 會被視為原始代碼;<code>String</code> 物件則會回傳,且被視作是其他物件。舉個例子:</p>
+
+<pre class="brush: js">s1 = "2 + 2"; // 建立一個字串原始型別
+s2 = new String("2 + 2"); // 建立一個字串物件
+console.log(eval(s1)); // 回傳數字 4
+console.log(eval(s2)); // 回傳字串 "2 + 2"
+</pre>
+
+<p>因為一些原因,程式碼也許在遇到 <code>String</code> 物件時,但需要的卻是字串原始型別;儘管如此,通常作者們不需要擔心它的差異。</p>
+
+<p>一個 <code>String</code> 物件總能夠使用 {{jsxref("String.valueOf", "valueOf")}} 方法被轉換成自身的原始副本。</p>
+
+<pre class="brush: js">console.log(eval(s2.valueOf())); // 回傳數字 4
+</pre>
+
+<div class="note"><strong>注意:</strong> 對於在 JavaScript 中其他可用的字串方法,請參閱這篇文章<a href="/en-US/docs/Web/JavaScript/Typed_arrays/StringView" title="/en-US/docs/Web/JavaScript/Typed_arrays/StringView"><code>StringView</code> – a C-like representation of strings based on typed arrays</a>。</div>
+
+<h2 id="Properties" name="Properties">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("String.prototype")}}</dt>
+ <dd>能讓字串物件增加屬性。</dd>
+</dl>
+
+<div>{{jsOverrides("Function", "Properties", "prototype")}}</div>
+
+<h2 id="Methods" name="Methods">方法</h2>
+
+<dl>
+ <dt>{{jsxref("String.fromCharCode()")}}</dt>
+ <dd>利用 Unicode 值的序列建立並回傳一個字串。</dd>
+ <dt>{{jsxref("String.fromCodePoint()")}} {{experimental_inline}}</dt>
+ <dd>利用編碼位置的序列建立並回傳一個字串。</dd>
+</dl>
+
+<div>{{jsOverrides("Function", "Methods", "fromCharCode", "fromCodePoint")}}</div>
+
+<h2 id="String_通用方法"><code>String</code> 通用方法</h2>
+
+<div class="warning">
+<p>字串通用方法是非標準化的、被棄用的,也有近期將被刪除的。</p>
+</div>
+
+<p>The <code>String </code>instance methods are also available in Firefox as of JavaScript 1.6 (though not part of the ECMAScript standard) on the String object for applying String methods to any object:</p>
+
+<pre class="brush: js">var num = 15;
+alert(String.replace(num, /5/, '2'));
+</pre>
+
+<p class="brush: js"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Array_generic_methods">Generics</a> are also available on {{jsxref("Global_Objects/Array", "Array")}} methods.</p>
+
+<p class="brush: js">The following is a shim to provide support to non-supporting browsers:</p>
+
+<pre class="brush: js">/*globals define*/
+// Assumes all supplied String instance methods already present
+// (one may use shims for these if not available)
+(function () {
+ 'use strict';
+
+ var i,
+ // We could also build the array of methods with the following, but the
+ // getOwnPropertyNames() method is non-shimable:
+ // Object.getOwnPropertyNames(String).filter(function (methodName)
+ // {return typeof String[methodName] === 'function'});
+ methods = [
+ 'quote', 'substring', 'toLowerCase', 'toUpperCase', 'charAt',
+ 'charCodeAt', 'indexOf', 'lastIndexOf', 'startsWith', 'endsWith',
+ 'trim', 'trimLeft', 'trimRight', 'toLocaleLowerCase',
+ 'toLocaleUpperCase', 'localeCompare', 'match', 'search',
+ 'replace', 'split', 'substr', 'concat', 'slice'
+ ],
+ methodCount = methods.length,
+ assignStringGeneric = function (methodName) {
+ var method = String.prototype[methodName];
+ String[methodName] = function (arg1) {
+ return method.apply(arg1, Array.prototype.slice.call(arguments, 1));
+ };
+ };
+
+ for (i = 0; i &lt; methodCount; i++) {
+ assignStringGeneric(methods[i]);
+ }
+}());</pre>
+
+<h2 id="String_instances" name="String_instances"><code>String</code> instances</h2>
+
+<h3 id="Properties_2">Properties</h3>
+
+<p>{{page('en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Properties')}}</p>
+
+<p>{{page('en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype', 'Methods')}}</p>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="String_conversion">String conversion</h3>
+
+<p>It's possible to use <code>String</code> as a "safer" {{jsxref("String.toString", "toString")}} alternative, as although it still normally calls the underlying <code>toString</code>, it also works for <code>null</code> and <code>undefined</code>. For example:</p>
+
+<pre class="brush: js">var outputStrings = [];
+for (let i = 0, n = inputValues.length; i &lt; n; ++i) {
+ outputStrings.push(String(inputValues[i]));
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5', 'String')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-string-objects', 'String')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string-objects', 'String')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.String")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{domxref("DOMString")}}</li>
+ <li><a href="/en-US/Add-ons/Code_snippets/StringView"><code>StringView</code> — a C-like representation of strings based on typed arrays</a></li>
+ <li><a href="/en-US/docs/Web/API/DOMString/Binary">Binary strings</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/match/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/match/index.html
new file mode 100644
index 0000000000..664b28462f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/match/index.html
@@ -0,0 +1,151 @@
+---
+title: String.prototype.match()
+slug: Web/JavaScript/Reference/Global_Objects/String/match
+translation_of: Web/JavaScript/Reference/Global_Objects/String/match
+---
+<div>{{JSRef}}</div>
+
+<p>The <strong><code>match()</code></strong> method retrieves the matches when matching a <em>string</em> against a <em>regular expression</em>.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><var>str</var>.match(<var>regexp</var>)</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>regexp</code></dt>
+ <dd>一個正規表達式的物件。 若傳入一個非正規表達式的物件<code>obj</code>,則會視為傳入 <code>new RegExp(obj)</code>。若只呼叫<code>match()</code>而沒有傳入任何參數,則會回傳內含一個空字串的陣列,即<code>[""]</code>。</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>If the string matches the expression, it will return an {{jsxref("Array")}} containing the entire matched string as the first element, followed by any results captured in parentheses. If there were no matches, {{jsxref("null")}} is returned.</p>
+
+<h2 id="Description">Description</h2>
+
+<p>If the regular expression does not include the <code>g</code> flag, <code>str.match()</code> will return the same result as {{jsxref("RegExp.prototype.exec()", "RegExp.exec()")}}. The returned {{jsxref("Array")}} has an extra <code>input</code> property, which contains the original string that was parsed. In addition, it has an <code>index</code> property, which represents the zero-based index of the match in the string.</p>
+
+<p>If the regular expression includes the <code>g</code> flag, the method returns an {{jsxref("Array")}} containing all matched substrings rather than match objects. Captured groups are not returned. If there were no matches, the method returns {{jsxref("null")}}.</p>
+
+<h3 id="See_also_RegExp_methods">See also: <code>RegExp</code> methods</h3>
+
+<ul>
+ <li>If you need to know if a string matches a regular expression {{jsxref("RegExp")}}, use {{jsxref("RegExp.prototype.test()", "RegExp.test()")}}.</li>
+ <li>If you only want the first match found, you might want to use {{jsxref("RegExp.prototype.exec()", "RegExp.exec()")}} instead.</li>
+ <li>if you want to obtain capture groups and the global flag is set, you need to use {{jsxref("RegExp.prototype.exec()", "RegExp.exec()")}} instead.</li>
+</ul>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Using_match()">Using <code>match()</code></h3>
+
+<p>In the following example, <code>match()</code> is used to find <code>'Chapter'</code> followed by 1 or more numeric characters followed by a decimal point and numeric character 0 or more times. The regular expression includes the <code>i</code> flag so that upper/lower case differences will be ignored.</p>
+
+<pre class="brush: js">var str = 'For more information, see Chapter 3.4.5.1';
+var re = /see (chapter \d+(\.\d)*)/i;
+var found = str.match(re);
+
+console.log(found);
+
+// logs [ 'see Chapter 3.4.5.1',
+// 'Chapter 3.4.5.1',
+// '.1',
+// index: 22,
+// input: 'For more information, see Chapter 3.4.5.1' ]
+
+// 'see Chapter 3.4.5.1' is the whole match.
+// 'Chapter 3.4.5.1' was captured by '(chapter \d+(\.\d)*)'.
+// '.1' was the last value captured by '(\.\d)'.
+// The 'index' property (22) is the zero-based index of the whole match.
+// The 'input' property is the original string that was parsed.</pre>
+
+<h3 id="Using_global_and_ignore_case_flags_with_match()">Using global and ignore case flags with <code>match()</code></h3>
+
+<p>The following example demonstrates the use of the global and ignore case flags with <code>match()</code>. All letters A through E and a through e are returned, each its own element in the array.</p>
+
+<pre class="brush: js">var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+var regexp = /[A-E]/gi;
+var matches_array = str.match(regexp);
+
+console.log(matches_array);
+// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']
+</pre>
+
+<h3 id="Using_match()_with_no_parameter">Using <code>match()</code> with no parameter</h3>
+
+<pre class="brush: js">var str = "Nothing will come of nothing.";
+
+str.match(); // returns [""]</pre>
+
+<h3 id="A_non-RegExp_object_as_the_parameter">A non-RegExp object as the parameter</h3>
+
+<p>When the parameter is a string or a number, it is implicitly converted to a {{jsxref("RegExp")}} by using new RegExp(obj). If it is a positive number with a positive sign,the RegExp() method will ignore the positive sign. </p>
+
+<pre class="brush: js">var str1 = "NaN means not a number. Infinity contains -Infinity and +Infinity in JavaScript.",
+ str2 = "My grandfather is 65 years old and My grandmother is 63 years old.",
+ str3 = "The contract was declared null and void.";
+str1.match("number");   // "number" is a string. returns ["number"]
+str1.match(NaN);   // the type of NaN is the number. returns ["NaN"]
+str1.match(Infinity);   // the type of Infinity is the number. returns ["Infinity"]
+str1.match(+Infinity);  // returns ["Infinity"]
+str1.match(-Infinity);  // returns ["-Infinity"]
+str2.match(65);   // returns ["65"]
+str2.match(+65);   // A number with a positive sign. returns ["65"]
+str3.match(null);   // returns ["null"]</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.10', 'String.prototype.match')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.match', 'String.prototype.match')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.match', 'String.prototype.match')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.match")}}</p>
+
+<h2 id="Firefox-specific_notes">Firefox-specific notes</h2>
+
+<ul>
+ <li><code>flags</code> was a non standard second argument only available in Gecko : <var>str</var>.match(<var>regexp, flags</var>)</li>
+ <li>Starting with Gecko 27 {{geckoRelease(27)}}, this method has been adjusted to conform with the ECMAScript specification. When <code>match()</code> is called with a global regular expression, the {{jsxref("RegExp.lastIndex")}} property (if specified) will be reset to <code>0</code> ({{bug(501739)}}).</li>
+ <li>Starting with Gecko 39 {{geckoRelease(39)}}, the non-standard <code>flags</code> argument is deprecated and throws a console warning ({{bug(1142351)}}).</li>
+ <li>Starting with Gecko 47 {{geckoRelease(47)}}, the non-standard <code>flags</code> argument is no longer supported in non-release builds and will soon be removed entirely ({{bug(1245801)}}).</li>
+ <li>Starting with Gecko 49 {{geckoRelease(49)}}, the non-standard <code>flags</code> argument is no longer supported ({{bug(1108382)}}).</li>
+</ul>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("RegExp")}}</li>
+ <li>{{jsxref("RegExp.prototype.exec()")}}</li>
+ <li>{{jsxref("RegExp.prototype.test()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html
new file mode 100644
index 0000000000..8a08d5924f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/padstart/index.html
@@ -0,0 +1,96 @@
+---
+title: String.prototype.padStart()
+slug: Web/JavaScript/Reference/Global_Objects/String/padStart
+translation_of: Web/JavaScript/Reference/Global_Objects/String/padStart
+---
+<div>{{JSRef}}{{SeeCompatTable}}</div>
+
+<p><strong><code>padStart()</code></strong><code> 會將用給定用於填充的字串,以重複的方式,插入到目標字串的起頭(左側),直到目標字串到達指定長度。</code></p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><var>str</var>.padStart(<var>targetLength</var> [, <var>padString</var>])</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>targetLength</code></dt>
+ <dd>目標字串被填充後的長度。如果此參數小於原字串的長度,那將直接返回原字串。</dd>
+ <dt><code>padString</code> {{optional_inline}}</dt>
+ <dd>用來填充的字串。如果填充字串太長,則由左側開始,擷取所需要的長度。此參數預設值是空白 " " (U+0020).</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>目標字串被填充到指定長度後,所得的新字串。</p>
+
+<h2 id="Examples">Examples</h2>
+
+<pre class="brush: js">'abc'.padStart(10); // "       abc"
+'abc'.padStart(10, "foo"); // "foofoofabc"
+'abc'.padStart(6,"123465"); // "123abc"
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<p>這個方法還沒有被納入 ECMAScript 標準。現在還只是個<a href="https://github.com/tc39/proposal-string-pad-start-end">提案</a>。</p>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(57)}} </td>
+ <td>15</td>
+ <td>{{CompatGeckoDesktop(51)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatOpera(44)}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatChrome(57)}}</td>
+ <td>{{CompatGeckoMobile(51)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatSafari(10)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("String.padEnd()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html
new file mode 100644
index 0000000000..41c7333dc6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/prototype/index.html
@@ -0,0 +1,176 @@
+---
+title: String.prototype
+slug: Web/JavaScript/Reference/Global_Objects/String/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/String
+---
+<div>{{JSRef}}</div>
+
+<p>The <strong><code>String.prototype</code></strong> property represents the {{jsxref("String")}} prototype object.</p>
+
+<div>{{js_property_attributes(0, 0, 0)}}</div>
+
+<h2 id="Description">Description</h2>
+
+<p>All {{jsxref("String")}} instances inherit from <code>String.prototype</code>. Changes to the <code>String</code> prototype object are propagated to all {{jsxref("String")}} instances.</p>
+
+<h2 id="Properties">Properties</h2>
+
+<dl>
+ <dt><code>String.prototype.constructor</code></dt>
+ <dd>Specifies the function that creates an object's prototype.</dd>
+ <dt>{{jsxref("String.prototype.length")}}</dt>
+ <dd>Reflects the length of the string.</dd>
+ <dt><code><em>N</em></code></dt>
+ <dd>Used to access the character in the <em>N</em>th position where <em>N</em> is a positive integer between 0 and one less than the value of {{jsxref("String.length", "length")}}. These properties are read-only.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<h3 id="Methods_unrelated_to_HTML">Methods unrelated to HTML</h3>
+
+<dl>
+ <dt>{{jsxref("String.prototype.charAt()")}}</dt>
+ <dd>Returns the character (exactly one UTF-16 code unit) at the specified index.</dd>
+ <dt>{{jsxref("String.prototype.charCodeAt()")}}</dt>
+ <dd>Returns a number that is the UTF-16 code unit value at the given index.</dd>
+ <dt>{{jsxref("String.prototype.codePointAt()")}}</dt>
+ <dd>Returns a nonnegative integer Number that is the code point value of the UTF-16 encoded code point starting at the specified index.</dd>
+ <dt>{{jsxref("String.prototype.concat()")}}</dt>
+ <dd>Combines the text of two strings and returns a new string.</dd>
+ <dt>{{jsxref("String.prototype.includes()")}}</dt>
+ <dd>Determines whether one string may be found within another string.</dd>
+ <dt>{{jsxref("String.prototype.endsWith()")}}</dt>
+ <dd>Determines whether a string ends with the characters of another string.</dd>
+ <dt>{{jsxref("String.prototype.indexOf()")}}</dt>
+ <dd>Returns the index within the calling {{jsxref("String")}} object of the first occurrence of the specified value, or -1 if not found.</dd>
+ <dt>{{jsxref("String.prototype.lastIndexOf()")}}</dt>
+ <dd>Returns the index within the calling {{jsxref("String")}} object of the last occurrence of the specified value, or -1 if not found.</dd>
+ <dt>{{jsxref("String.prototype.localeCompare()")}}</dt>
+ <dd>Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.</dd>
+ <dt>{{jsxref("String.prototype.match()")}}</dt>
+ <dd>Used to match a regular expression against a string.</dd>
+ <dt>{{jsxref("String.prototype.normalize()")}}</dt>
+ <dd>Returns the Unicode Normalization Form of the calling string value.</dd>
+ <dt>{{jsxref("String.prototype.padEnd()")}}</dt>
+ <dd>Pads the current string from the end with a given string to create a new string from a given length.</dd>
+ <dt>{{jsxref("String.prototype.padStart()")}}</dt>
+ <dd>Pads the current string from the start with a given string to create a new string from a given length.</dd>
+ <dt><s class="obsoleteElement">{{jsxref("String.prototype.quote()")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">Wraps the string in double quotes ("<code>"</code>").</s></dd>
+ <dt>{{jsxref("String.prototype.repeat()")}}</dt>
+ <dd>Returns a string consisting of the elements of the object repeated the given times.</dd>
+ <dt>{{jsxref("String.prototype.replace()")}}</dt>
+ <dd>Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.</dd>
+ <dt>{{jsxref("String.prototype.search()")}}</dt>
+ <dd>Executes the search for a match between a regular expression and a specified string.</dd>
+ <dt>{{jsxref("String.prototype.slice()")}}</dt>
+ <dd>Extracts a section of a string and returns a new string.</dd>
+ <dt>{{jsxref("String.prototype.split()")}}</dt>
+ <dd>Splits a {{jsxref("Global_Objects/String", "String")}} object into an array of strings by separating the string into substrings.</dd>
+ <dt>{{jsxref("String.prototype.startsWith()")}}</dt>
+ <dd>Determines whether a string begins with the characters of another string.</dd>
+ <dt>{{jsxref("String.prototype.substr()")}}</dt>
+ <dd>Returns the characters in a string beginning at the specified location through the specified number of characters.</dd>
+ <dt>{{jsxref("String.prototype.substring()")}}</dt>
+ <dd>Returns the characters in a string between two indexes into the string.</dd>
+ <dt>{{jsxref("String.prototype.toLocaleLowerCase()")}}</dt>
+ <dd>The characters within a string are converted to lower case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}}.</dd>
+ <dt>{{jsxref("String.prototype.toLocaleUpperCase()")}}</dt>
+ <dd>The characters within a string are converted to upper case while respecting the current locale. For most languages, this will return the same as {{jsxref("String.prototype.toUpperCase()", "toUpperCase()")}}.</dd>
+ <dt>{{jsxref("String.prototype.toLowerCase()")}}</dt>
+ <dd>Returns the calling string value converted to lower case.</dd>
+ <dt>{{jsxref("String.prototype.toSource()")}} {{non-standard_inline}}</dt>
+ <dd>Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.</dd>
+ <dt>{{jsxref("String.prototype.toString()")}}</dt>
+ <dd>Returns a string representing the specified object. Overrides the {{jsxref("Object.prototype.toString()")}} method.</dd>
+ <dt>{{jsxref("String.prototype.toUpperCase()")}}</dt>
+ <dd>Returns the calling string value converted to uppercase.</dd>
+ <dt>{{jsxref("String.prototype.trim()")}}</dt>
+ <dd>Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.</dd>
+ <dt>{{jsxref("String.prototype.trimLeft()")}} {{non-standard_inline}}</dt>
+ <dd>Trims whitespace from the left side of the string.</dd>
+ <dt>{{jsxref("String.prototype.trimRight()")}} {{non-standard_inline}}</dt>
+ <dd>Trims whitespace from the right side of the string.</dd>
+ <dt>{{jsxref("String.prototype.valueOf()")}}</dt>
+ <dd>Returns the primitive value of the specified object. Overrides the {{jsxref("Object.prototype.valueOf()")}} method.</dd>
+ <dt>{{jsxref("String.prototype.@@iterator()", "String.prototype[@@iterator]()")}}</dt>
+ <dd>Returns a new <code>Iterator</code> object that iterates over the code points of a String value, returning each code point as a String value.</dd>
+</dl>
+
+<h3 id="HTML_wrapper_methods">HTML wrapper methods</h3>
+
+<p>These methods are of limited use, as they provide only a subset of the available HTML tags and attributes.</p>
+
+<dl>
+ <dt>{{jsxref("String.prototype.anchor()")}}</dt>
+ <dd>{{htmlattrxref("name", "a", "&lt;a name=\"name\"&gt;")}} (hypertext target)</dd>
+ <dt>{{jsxref("String.prototype.big()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("big")}}</dd>
+ <dt>{{jsxref("String.prototype.blink()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("blink")}}</dd>
+ <dt>{{jsxref("String.prototype.bold()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("b")}}</dd>
+ <dt>{{jsxref("String.prototype.fixed()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("tt")}}</dd>
+ <dt>{{jsxref("String.prototype.fontcolor()")}} {{deprecated_inline}}</dt>
+ <dd>{{htmlattrxref("color", "font", "&lt;font color=\"color\"&gt;")}}</dd>
+ <dt>{{jsxref("String.prototype.fontsize()")}} {{deprecated_inline}}</dt>
+ <dd>{{htmlattrxref("size", "font", "&lt;font size=\"size\"&gt;")}}</dd>
+ <dt>{{jsxref("String.prototype.italics()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("i")}}</dd>
+ <dt>{{jsxref("String.prototype.link()")}}</dt>
+ <dd>{{htmlattrxref("href", "a", "&lt;a href=\"url\"&gt;")}} (link to URL)</dd>
+ <dt>{{jsxref("String.prototype.small()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("small")}}</dd>
+ <dt>{{jsxref("String.prototype.strike()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("strike")}}</dd>
+ <dt>{{jsxref("String.prototype.sub()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("sub")}}</dd>
+ <dt>{{jsxref("String.prototype.sup()")}} {{deprecated_inline}}</dt>
+ <dd>{{HTMLElement("sup")}}</dd>
+</dl>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.3.1', 'String.prototype')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype', 'String.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype', 'String.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.prototype")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("String")}}</li>
+ <li>{{jsxref("Function.prototype")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html
new file mode 100644
index 0000000000..1c42d9925f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/replace/index.html
@@ -0,0 +1,286 @@
+---
+title: String.prototype.replace()
+slug: Web/JavaScript/Reference/Global_Objects/String/replace
+translation_of: Web/JavaScript/Reference/Global_Objects/String/replace
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>replace()</code></strong> 方法會傳回一個新字串,此新字串是透過將原字串與 <code>pattern</code> 比對,以 <code>replacement</code> 取代吻合處而生成。<code>pattern</code> 可以是字串或 {{jsxref("RegExp")}},而 <code>replacement</code> 可以是字串或函式(會在每一次匹配時被呼叫)。</p>
+
+<div class="note">
+<p>備註:原始的字串會保持不變。</p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>str</var>.replace(<var>regexp</var>|<var>substr</var>, <var>newSubstr</var>|<var>function</var>)</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>regexp</code> (pattern)</dt>
+ <dd>{{jsxref("RegExp")}} 的物件或文字。 被比對出來的部分將會被取代為 <code>newSubStr</code> 或是取代為 <code>function</code> 的回傳值。</dd>
+ <dt><code>substr</code> (pattern)</dt>
+ <dd>要被 <code>newSubStr</code> 取代的 {{jsxref("String")}}。它被視為逐字字符串,並且不會被解釋為正則表達式。只會替換第一次出現。</dd>
+ <dt><code>newSubStr</code> (replacement)</dt>
+ <dd>The {{jsxref("String")}} that replaces the substring specified by the specified <code>regexp</code> or <code>substr</code> parameter. A number of special replacement patterns are supported; see the "<a href="#指定一個字串為參數">Specifying a string as a parameter</a>" section below.</dd>
+ <dt><code>function</code> (replacement)</dt>
+ <dd>A function to be invoked to create the new substring to be used to replace the matches to the given <code>regexp</code> or <code>substr</code>. The arguments supplied to this function are described in the "<a href="#指定一個函式為參數">Specifying a function as a parameter</a>" section below.</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>A new string with some or all matches of a pattern replaced by a replacement.</p>
+
+<h2 id="描述">描述</h2>
+
+<p>這個方法不會變更所呼叫的 {{jsxref("String")}}。它只會回傳新的字串。</p>
+
+<p>To perform a global search and replace, include the <code>g</code> switch in the regular expression.</p>
+
+<h3 id="指定一個字串為參數">指定一個字串為參數</h3>
+
+<p>The replacement string can include the following special replacement patterns:</p>
+
+<table class="fullwidth-table">
+ <tbody>
+ <tr>
+ <td class="header">Pattern</td>
+ <td class="header">Inserts</td>
+ </tr>
+ <tr>
+ <td><code>$$</code></td>
+ <td>Inserts a "$".</td>
+ </tr>
+ <tr>
+ <td><code>$&amp;</code></td>
+ <td>Inserts the matched substring.</td>
+ </tr>
+ <tr>
+ <td><code>$`</code></td>
+ <td>Inserts the portion of the string that precedes the matched substring.</td>
+ </tr>
+ <tr>
+ <td><code>$'</code></td>
+ <td>Inserts the portion of the string that follows the matched substring.</td>
+ </tr>
+ <tr>
+ <td><code>$<em>n</em></code></td>
+ <td>Where <code><em>n</em></code> is a positive integer less than 100, inserts the <em>n</em>th parenthesized submatch string, provided the first argument was a {{jsxref("RegExp")}} object.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h3 id="指定一個函式為參數">指定一個函式為參數</h3>
+
+<p>You can specify a function as the second parameter. In this case, the function will be invoked after the match has been performed. The function's result (return value) will be used as the replacement string. (Note: the above-mentioned special replacement patterns do <em>not</em> apply in this case.) Note that the function will be invoked multiple times for each full match to be replaced if the regular expression in the first parameter is global.</p>
+
+<p>The arguments to the function are as follows:</p>
+
+<table class="fullwidth-table">
+ <tbody>
+ <tr>
+ <td class="header">Possible name</td>
+ <td class="header">Supplied value</td>
+ </tr>
+ <tr>
+ <td><code>match</code></td>
+ <td>The matched substring. (Corresponds to <code>$&amp;</code> above.)</td>
+ </tr>
+ <tr>
+ <td><code>p1, p2, ...</code></td>
+ <td>The <em>n</em>th parenthesized submatch string, provided the first argument to <code>replace()</code> was a {{jsxref("RegExp")}} object. (Corresponds to <code>$1</code>, <code>$2</code>, etc. above.) For example, if <code>/(\a+)(\b+)/</code>, was given, <code>p1</code> is the match for <code>\a+</code>, and <code>p2</code> for <code>\b+</code>.</td>
+ </tr>
+ <tr>
+ <td><code>offset</code></td>
+ <td>The offset of the matched substring within the whole string being examined. (For example, if the whole string was <code>'abcd'</code>, and the matched substring was <code>'bc'</code>, then this argument will be 1.)</td>
+ </tr>
+ <tr>
+ <td><code>string</code></td>
+ <td>The whole string being examined.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>(The exact number of arguments will depend on whether the first argument was a {{jsxref("RegExp")}} object and, if so, how many parenthesized submatches it specifies.)</p>
+
+<p>The following example will set <code>newString</code> to <code>'abc - 12345 - #$*%'</code>:</p>
+
+<pre class="brush: js">function replacer(match, p1, p2, p3, offset, string) {
+ // p1 is nondigits, p2 digits, and p3 non-alphanumerics
+ return [p1, p2, p3].join(' - ');
+}
+var newString = 'abc12345#$*%'.replace(/([^\d]*)(\d*)([^\w]*)/, replacer);
+console.log(newString); // abc - 12345 - #$*%
+</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="於_replace()_中定義正則表示式">於 <code>replace()</code> 中定義正則表示式</h3>
+
+<p>下例的正規表達式被定義為 <code>replace()</code>、並包含了忽略大小寫的 flag。</p>
+
+<pre class="brush: js">var str = 'Twas the night before Xmas...';
+var newstr = str.replace(/xmas/i, 'Christmas');
+console.log(newstr); // Twas the night before Christmas...
+</pre>
+
+<p>上例會顯示「Twas the night before Christmas...」</p>
+
+<h3 id="使用_global_及_ignore_來配合_replace()">使用 <code>global</code> 及 <code>ignore</code> 來配合 <code>replace()</code></h3>
+
+<p>Global replace can only be done with a regular expression. In the following example, the regular expression includes the global and ignore case flags which permits <code>replace()</code> to replace each occurrence of 'apples' in the string with 'oranges'.</p>
+
+<pre class="brush: js">var re = /apples/gi;
+var str = 'Apples are round, and apples are juicy.';
+var newstr = str.replace(re, 'oranges');
+console.log(newstr); // oranges are round, and oranges are juicy.
+</pre>
+
+<p>上例會顯示「oranges are round, and oranges are juicy」。</p>
+
+<h3 id="替換字串中的單字">替換字串中的單字</h3>
+
+<p>下例程式將切換字串內的單字。對 replacement text 而言,程式會使用 <code>$1</code> and <code>$2</code> 的 replacement pattern。</p>
+
+<pre class="brush: js">var re = /(\w+)\s(\w+)/;
+var str = 'John Smith';
+var newstr = str.replace(re, '$2, $1');
+console.log(newstr); // Smith, John
+</pre>
+
+<p>上例會顯示「Smith, John」。</p>
+
+<h3 id="使用行內函式來修改匹配的字元">使用行內函式來修改匹配的字元</h3>
+
+<p>In this example, all occurrences of capital letters in the string are converted to lower case, and a hyphen is inserted just before the match location. The important thing here is that additional operations are needed on the matched item before it is given back as a replacement.</p>
+
+<p>The replacement function accepts the matched snippet as its parameter, and uses it to transform the case and concatenate the hyphen before returning.</p>
+
+<pre class="brush: js">function styleHyphenFormat(propertyName) {
+ function upperToHyphenLower(match, offset, string) {
+ return (offset ? '-' : '') + match.toLowerCase();
+ }
+ return propertyName.replace(/[A-Z]/g, upperToHyphenLower);
+}
+</pre>
+
+<p>Given <code>styleHyphenFormat('borderTop')</code>, this returns 'border-top'.</p>
+
+<p>Because we want to further transform the <em>result</em> of the match before the final substitution is made, we must use a function. This forces the evaluation of the match prior to the {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}} method. If we had tried to do this using the match without a function, the {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}} would have no effect.</p>
+
+<pre class="brush: js">var newString = propertyName.replace(/[A-Z]/g, '-' + '$&amp;'.toLowerCase()); // won't work
+</pre>
+
+<p>This is because <code>'$&amp;'.toLowerCase()</code> would be evaluated first as a string literal (resulting in the same <code>'$&amp;'</code>) before using the characters as a pattern.</p>
+
+<h3 id="將華氏溫度置換成攝氏溫度">將華氏溫度置換成攝氏溫度</h3>
+
+<p>The following example replaces a Fahrenheit degree with its equivalent Celsius degree. The Fahrenheit degree should be a number ending with F. The function returns the Celsius number ending with C. For example, if the input number is 212F, the function returns 100C. If the number is 0F, the function returns -17.77777777777778C.</p>
+
+<p>The regular expression <code>test</code> checks for any number that ends with F. The number of Fahrenheit degree is accessible to the function through its second parameter, <code>p1</code>. The function sets the Celsius number based on the Fahrenheit degree passed in a string to the <code>f2c()</code> function. <code>f2c()</code> then returns the Celsius number. This function approximates Perl's <code>s///e</code> flag.</p>
+
+<pre class="brush: js">function f2c(x) {
+ function convert(str, p1, offset, s) {
+ return ((p1 - 32) * 5/9) + 'C';
+ }
+ var s = String(x);
+ var test = /(-?\d+(?:\.\d*)?)F\b/g;
+ return s.replace(test, convert);
+}
+</pre>
+
+<h3 id="利用行內函式及正則表示式來避免使用_for_迴圈">利用行內函式及正則表示式來避免使用 <code>for</code> 迴圈</h3>
+
+<p>The following example takes a string pattern and converts it into an array of objects.</p>
+
+<p><strong>Input:</strong></p>
+
+<p>A string made out of the characters <code>x</code>, <code>-</code> and <code>_</code></p>
+
+<pre>x-x_
+x---x---x---x---
+x-xxx-xx-x-
+x_x_x___x___x___
+</pre>
+
+<p><strong>Output:</strong></p>
+
+<p>An array of objects. An <code>'x'</code> denotes an <code>'on'</code> state, a <code>'-'</code> (hyphen) denotes an <code>'off'</code> state and an <code>'_'</code> (underscore) denotes the length of an <code>'on'</code> state.</p>
+
+<pre class="brush: json">[
+ { on: true, length: 1 },
+ { on: false, length: 1 },
+ { on: true, length: 2 }
+ ...
+]
+</pre>
+
+<p><strong>Snippet:</strong></p>
+
+<pre class="brush: js">var str = 'x-x_';
+var retArr = [];
+str.replace(/(x_*)|(-)/g, function(match, p1, p2) {
+ if (p1) { retArr.push({ on: true, length: p1.length }); }
+ if (p2) { retArr.push({ on: false, length: 1 }); }
+});
+
+console.log(retArr);
+</pre>
+
+<p>This snippet generates an array of 3 objects in the desired format without using a <code>for</code> loop.</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.11', 'String.prototype.replace')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.replace', 'String.prototype.replace')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.replace', 'String.prototype.replace')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p class="hidden">本相容性表格使用結構化資料自動產生。想要貢獻的話,請看看 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 並發個 PR。</p>
+
+<p>{{Compat("javascript.builtins.String.replace")}}</p>
+
+<h2 id="Firefox-specific_notes">Firefox-specific notes</h2>
+
+<ul>
+ <li>Starting with Gecko 27 {{geckoRelease(27)}}, this method has been adjusted to conform with the ECMAScript specification. When <code>replace()</code> is called with a global regular expression, the {{jsxref("RegExp.lastIndex")}} property (if specified) will be reset to <code>0</code> ({{bug(501739)}}).</li>
+ <li>Starting with Gecko 39 {{geckoRelease(39)}}, the non-standard <code>flags</code> argument is deprecated and throws a console warning ({{bug(1142351)}}).</li>
+ <li>Starting with Gecko 47 {{geckoRelease(47)}}, the non-standard <code>flags</code> argument is no longer supported in non-release builds and will soon be removed entirely ({{bug(1245801)}}).</li>
+ <li>Starting with Gecko 49 {{geckoRelease(49)}}, the non-standard <code>flags</code> argument is no longer supported ({{bug(1108382)}}).</li>
+</ul>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.match()")}}</li>
+ <li>{{jsxref("RegExp.prototype.exec()")}}</li>
+ <li>{{jsxref("RegExp.prototype.test()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/string/tolowercase/index.html b/files/zh-tw/web/javascript/reference/global_objects/string/tolowercase/index.html
new file mode 100644
index 0000000000..35b9dc71bc
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/string/tolowercase/index.html
@@ -0,0 +1,77 @@
+---
+title: String.prototype.toLowerCase()
+slug: Web/JavaScript/Reference/Global_Objects/String/toLowerCase
+translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>toLowerCase()</code></strong> 函式会回传将字符串转换为英文小写字母后的结果。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/string-tolowercase.html")}}</div>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><code><var>str</var>.toLowerCase()</code></pre>
+
+<h3 id="回传值">回传值</h3>
+
+<p>回传一组将原字串英文内容转换成英文小写字母后的结果。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>The <code>toLowerCase()</code> 函式会回传一组将原字符串英文内容转换成英文小写字母后的结果。 <code>toLowerCase()</code> 并不会影响到原字符串 <code>str</code> 的内容值。</p>
+
+<h2 id="范例">范例</h2>
+
+<h3 id="使用toLowerCase()">使用<code>toLowerCase()</code></h3>
+
+<pre class="brush: js">console.log('ALPHABET'.toLowerCase()); // 'alphabet'
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.16', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器相容性">浏览器相容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("javascript.builtins.String.toLowerCase")}}</p>
+
+<h2 id="参考">参考</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.toLocaleLowerCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLocaleUpperCase()")}}</li>
+ <li>{{jsxref("String.prototype.toUpperCase()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html b/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html
new file mode 100644
index 0000000000..f37e7ac069
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/typedarray/index.html
@@ -0,0 +1,268 @@
+---
+title: TypedArray
+slug: Web/JavaScript/Reference/Global_Objects/TypedArray
+tags:
+ - JavaScript
+ - TypedArray
+ - TypedArrays
+translation_of: Web/JavaScript/Reference/Global_Objects/TypedArray
+---
+<div>{{JSRef}}</div>
+
+<p><strong><em>TypedArray</em></strong> 物件表示了一個底層 <code><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/JavaScript_typed_arrays/ArrayBuffer">ArrayBuffer</a></code> 的類陣列(array-like)視圖,它能以限定的型別解讀、修改 <code>ArrayBuffer</code>。但並沒有名為 <code>TypedArray</code> 的內建物件,<code>TypedArray</code> 也不存在可直接呼叫的建構式。真正能夠使用的是幾個原型繼承自 <code>TypedArray</code> 的內建物件,它們可以建立限定成員型別的物件實體來操作 <code>ArrayBuffer</code>。這些 <code>TypedArray</code> 型別的物件僅為視圖,並不會存放資料,所有的資料皆實際儲存於 <code>ArrayBuffer</code> 物件當中。以下將說明每種限定成員型別之 <code>TypedArray</code> 的共同屬性與方法。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/typedarray-constructor.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">new<em> TypedArray</em>(length);
+new <em>TypedArray</em>(typedArray);
+new <em>TypedArray</em>(object);
+new <em>TypedArray</em>(buffer [, byteOffset [, length]]);
+
+where <em>TypedArray()</em> is one of:
+
+Int8Array();
+Uint8Array();
+Uint8ClampedArray();
+Int16Array();
+Uint16Array();
+Int32Array();
+Uint32Array();
+Float32Array();
+Float64Array();
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt>length</dt>
+ <dd>When called with a <code>length</code> argument, a typed array containing <code>length</code> zeroes is created.</dd>
+ <dt>typedArray</dt>
+ <dd>When called with a <code>typedArray</code> argument, which can be an object of any of the typed array types (such as <code>Int32Array</code>), the <code>typedArray</code> gets copied into a new typed array. Each value in <code>typedArray</code> is converted to the corresponding type of the constructor before being copied into the new array.</dd>
+ <dt>object</dt>
+ <dd>When called with an <code>object</code> argument, a new typed array is created as if by the <code><em>TypedArray</em>.from()</code> method.</dd>
+ <dt>buffer, byteOffset, length</dt>
+ <dd>When called with a <code>buffer</code>, and optionally a <code>byteOffset</code> and a <code>length</code> argument, a new typed array view is created that views the specified {{jsxref("ArrayBuffer")}}. The <code>byteOffset</code> and <code>length</code> parameters specify the memory range that will be exposed by the typed array view.  If both are omitted, all of <code>buffer</code> is viewed; if only <code>length</code> is omitted, the remainder of <code>buffer</code> is viewed.</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>ECMAScript 2015 defines a <em>TypedArray</em> constructor that serves as the <code>[[Prototype]]</code> of all <em>TypedArray</em> constructors.  This constructor is not directly exposed: there is no global <code>%TypedArray%</code> or <code>TypedArray</code> property.  It is only directly accessible through <code>Object.getPrototypeOf(Int8Array)</code> and similar.  All <em>TypedArray</em>s constructors inherit common properties from the <code>%TypedArray%</code> constructor function.  Additionally, all typed array prototypes (<em>TypedArray</em><code>.prototype</code>) have <code>%TypedArray%.prototype</code> as their <code>[[Prototype]]</code>.</p>
+
+<p>The <code>%TypedArray%</code> constructor on its own is not particularly useful.  Calling it or using it in a <code>new</code> expression will throw a <code>TypeError</code>, except when used during object creation in JS engines that support subclassing.  There are at present no such engines, so <code>%TypedArray%</code> is only useful to polyfill functions or properties onto all <em>TypedArray</em> constructors.</p>
+
+<p>When creating an instance of a <em>TypedArray</em> (e.g. <code>Int8Array</code>), an array buffer is created internally in memory or, if an <code>ArrayBuffer</code> object is given as constructor argument, then this is used instead.  The buffer address is saved as an internal property of the instance and all the methods of %<code>TypedArray</code>%.<code>prototype</code>, i.e. set value and get value etc., operate on that array buffer address.</p>
+
+<h3 id="Property_access">Property access</h3>
+
+<p>You can reference elements in the array using standard array index syntax (that is, using bracket notation). However, getting or setting indexed properties on typed arrays will not search in the prototype chain for this property, even when the indices are out of bound. Indexed properties will consult the {{jsxref("ArrayBuffer")}} and will never look at object properties. You can still use named properties, just like with all objects.</p>
+
+<pre class="brush: js">// Setting and getting using standard array syntax
+var int16 = new Int16Array(2);
+int16[0] = 42;
+console.log(int16[0]); // 42
+
+// Indexed properties on prototypes are not consulted (Fx 25)
+Int8Array.prototype[20] = 'foo';
+(new Int8Array(32))[20]; // 0
+// even when out of bound
+Int8Array.prototype[20] = 'foo';
+(new Int8Array(8))[20]; // undefined
+// or with negative integers
+Int8Array.prototype[-1] = 'foo';
+(new Int8Array(8))[-1]; // undefined
+
+// Named properties are allowed, though (Fx 30)
+Int8Array.prototype.foo = 'bar';
+(new Int8Array(32)).foo; // "bar"</pre>
+
+<h2 id="TypedArray_物件">TypedArray 物件</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">Type</td>
+ <td class="header">Value Range</td>
+ <td class="header">Size in bytes</td>
+ <td class="header">Description</td>
+ <td class="header">Web IDL type</td>
+ <td class="header">Equivalent C type</td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Int8Array")}}</td>
+ <td>-128 to 127</td>
+ <td>1</td>
+ <td>8-bit two's complement signed integer</td>
+ <td><code>byte</code></td>
+ <td><code>int8_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Uint8Array")}}</td>
+ <td>0 to 255</td>
+ <td>1</td>
+ <td>8-bit unsigned integer</td>
+ <td><code>octet</code></td>
+ <td><code>uint8_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Uint8ClampedArray")}}</td>
+ <td>0 to 255</td>
+ <td>1</td>
+ <td>8-bit unsigned integer (clamped)</td>
+ <td><code>octet</code></td>
+ <td><code>uint8_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Int16Array")}}</td>
+ <td>-32768 to 32767</td>
+ <td>2</td>
+ <td>16-bit two's complement signed integer</td>
+ <td><code>short</code></td>
+ <td><code>int16_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Uint16Array")}}</td>
+ <td>0 to 65535</td>
+ <td>2</td>
+ <td>16-bit unsigned integer</td>
+ <td><code>unsigned short</code></td>
+ <td><code>uint16_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Int32Array")}}</td>
+ <td>-2147483648 to 2147483647</td>
+ <td>4</td>
+ <td>32-bit two's complement signed integer</td>
+ <td><code>long</code></td>
+ <td><code>int32_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Uint32Array")}}</td>
+ <td>0 to 4294967295</td>
+ <td>4</td>
+ <td>32-bit unsigned integer</td>
+ <td><code>unsigned long</code></td>
+ <td><code>uint32_t</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Float32Array")}}</td>
+ <td>1.2x10<sup>-38</sup> to 3.4x10<sup>38</sup></td>
+ <td>4</td>
+ <td>32-bit IEEE floating point number ( 7 significant digits e.g. 1.1234567)</td>
+ <td><code>unrestricted float</code></td>
+ <td><code>float</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Float64Array")}}</td>
+ <td>5.0x10<sup>-324</sup> to 1.8x10<sup>308</sup></td>
+ <td>8</td>
+ <td>64-bit IEEE floating point number (16 significant digits e.g. 1.123...15)</td>
+ <td><code>unrestricted double</code></td>
+ <td><code>double</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("TypedArray.BYTES_PER_ELEMENT")}}</dt>
+ <dd>Returns a number value of the element size for the different typed array objects.</dd>
+ <dt><em>TypedArray</em>.length</dt>
+ <dd>Length property whose value is 0.</dd>
+ <dt>{{jsxref("TypedArray.name")}}</dt>
+ <dd>Returns the string value of the constructor name. E.g "Int8Array".</dd>
+ <dt>{{jsxref("TypedArray.@@species", "get TypedArray[@@species]")}}</dt>
+ <dd>The constructor function that is used to create derived objects.</dd>
+ <dt>{{jsxref("TypedArray.prototype")}}</dt>
+ <dd>Prototype for the <em>TypedArray</em> objects.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("TypedArray.from()")}}</dt>
+ <dd>Creates a new typed array from an array-like or iterable object. See also {{jsxref("Array.from()")}}.</dd>
+ <dt>{{jsxref("TypedArray.of()")}}</dt>
+ <dd>Creates a new typed array with a variable number of arguments. See also {{jsxref("Array.of()")}}.</dd>
+</dl>
+
+<h2 id="TypedArray_原型">TypedArray 原型</h2>
+
+<p>All <em>TypedArray</em>s inherit from {{jsxref("TypedArray.prototype")}}.</p>
+
+<h3 id="屬性_2">屬性</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/TypedArray/prototype','Properties')}}</p>
+
+<h3 id="方法_2">方法</h3>
+
+<p>{{page('en-US/Web/JavaScript/Reference/Global_Objects/TypedArray/prototype','Methods')}}</p>
+
+<h3 id="Methods_Polyfill">Methods Polyfill</h3>
+
+<p>Many of the methods used in Typed Arrays can be polyfilled using the methods present in regular Javascript Arrays. The following snippet of JavaScript demonstrates how you might polyfill any missing Typed Array methods.</p>
+
+<pre class="brush: js example-bad">var typedArrayTypes = [<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array" title="The Int8Array typed array represents an array of twos-complement 8-bit signed integers. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Int8Array</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" title="The Uint8Array typed array represents an array of 8-bit unsigned integers. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Uint8Array</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray" title="The Uint8ClampedArray typed array represents an array of 8-bit unsigned integers clamped to 0-255; if you specified a value that is out of the range of [0,255], 0 or 255 will be set instead; if you specify a non-integer, the nearest integer will be set. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Uint8ClampedArray</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array" title="The Int16Array typed array represents an array of twos-complement 16-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Int16Array</a>,
+</code>          <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array" title="The Uint16Array typed array represents an array of 16-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Uint16Array</a>, ​​​<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array" title="The Int32Array typed array represents an array of twos-complement 32-bit signed integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Int32Array</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array" title="The Uint32Array typed array represents an array of 32-bit unsigned integers in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Uint32Array</a>, ​​​<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array" title="The Float32Array typed array represents an array of 32-bit floating point numbers (corresponding to the C float data type) in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).">Float32Array</a>, </code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array" title="The Float64Array typed array represents an array of 64-bit floating point numbers (corresponding to the C double data type) in the platform byte order. If control over byte order is needed, use DataView instead. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation)."><code>Float64Array</code></a>];
+
+for (var k in typedArrayTypes)
+    for (var v in Array.prototype)
+        if (Array.prototype.hasOwnProperty(v) &amp;&amp;
+         !typedArrayTypes[k].prototype.hasOwnProperty(v))
+            typedArrayTypes[k].prototype[v] = Array.prototype[v];
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Typed Array')}}</td>
+ <td>{{Spec2('Typed Array')}}</td>
+ <td>Defined as <code>TypedArray</code> and <code>ArrayBufferView</code> interface with typed array view types. Superseded by ECMAScript 6.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-typedarray-objects', 'TypedArray Objects')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition in an ECMA standard. Specified behaviour for indexed and named properties. Specified that <code>new</code> is required.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-typedarray-objects', 'TypedArray Objects')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.TypedArray")}}</p>
+
+<h2 id="相容性備註">相容性備註</h2>
+
+<p>Starting with ECMAScript 2015, <code>TypedArray</code> constructors require to be constructed with a {{jsxref("Operators/new", "new")}} operator. Calling a <code>TypedArray</code> constructor as a function without <code>new</code>, will throw a {{jsxref("TypeError")}} from now on.</p>
+
+<pre class="brush: js example-bad">var dv = Int8Array([1, 2, 3]);
+// TypeError: calling a builtin Int8Array constructor
+// without new is forbidden</pre>
+
+<pre class="brush: js example-good">var dv = new Int8Array([1, 2, 3]);</pre>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Typed_arrays" title="en/JavaScript typed arrays">JavaScript typed arrays</a></li>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+ <li>{{jsxref("DataView")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html b/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html
new file mode 100644
index 0000000000..f352c84d71
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/undefined/index.html
@@ -0,0 +1,136 @@
+---
+title: undefined
+slug: Web/JavaScript/Reference/Global_Objects/undefined
+tags:
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Global_Objects/undefined
+---
+<div>{{jsSidebar("Objects")}}</div>
+
+<p>The global <code><strong>undefined</strong></code> property represents the primitive value <code>{{Glossary("Undefined", "undefined")}}</code>. It is one of JavaScript's {{Glossary("Primitive", "primitive types")}}.</p>
+
+<p>{{js_property_attributes(0,0,0)}}</p>
+
+<div>{{EmbedInteractiveExample("pages/js/globalprops-undefined.html")}}</div>
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>undefined</code></pre>
+
+<h2 id="描述">描述</h2>
+
+<p><code>undefined</code> is a property of the <em>global object</em>; i.e., it is a variable in global scope. The initial value of <code>undefined</code> is the primitive value <code>{{Glossary("Undefined", "undefined")}}</code>.</p>
+
+<p>In modern browsers (JavaScript 1.8.5 / Firefox 4+), <code>undefined</code> is a non-configurable, non-writable property per the ECMAScript 5 specification. Even when this is not the case, avoid overriding it.</p>
+
+<p>A variable that has not been assigned a value is of type undefined. A method or statement also returns <code>undefined</code> if the variable that is being evaluated does not have an assigned value. A function returns <code>undefined</code> if a value was not {{jsxref("Statements/return", "returned")}}.</p>
+
+<div class="warning">
+<p>While it is possible to use it as an {{Glossary("Identifier", "identifier")}} (variable name) in any scope other than the global scope (because <code>undefined</code> is not a {{jsxref("Reserved_Words", "reserved word")}}), doing so is a very bad idea that will make your code difficult to maintain and debug.</p>
+
+<pre class="brush: js">//DON'T DO THIS
+
+// logs "foo string"
+(function() { var undefined = 'foo'; console.log(undefined, typeof undefined); })();
+
+// logs "foo string"
+(function(undefined) { console.log(undefined, typeof undefined); })('foo');
+</pre>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Strict_equality_and_undefined">Strict equality and <code>undefined</code></h3>
+
+<p>You can use <code>undefined</code> and the strict equality and inequality operators to determine whether a variable has a value. In the following code, the variable <code>x</code> is not defined, and the <code>if</code> statement evaluates to true.</p>
+
+<pre class="brush: js">var x;
+if (x === undefined) {
+ // these statements execute
+}
+else {
+ // these statements do not execute
+}
+</pre>
+
+<div class="note">
+<p>備註:The strict equality operator rather than the standard equality operator must be used here, because <code>x == undefined</code> also checks whether <code>x</code> is <code>null</code>, while strict equality doesn't. <code>null</code> is not equivalent to <code>undefined</code>. See {{jsxref("Operators/Comparison_Operators", "comparison operators")}} for details.</p>
+</div>
+
+<h3 id="Typeof_operator_and_undefined"><code>Typeof</code> operator and <code>undefined</code></h3>
+
+<p>Alternatively, {{jsxref("Operators/typeof", "typeof")}} can be used:</p>
+
+<pre class="brush: js">var x;
+if (typeof x === 'undefined') {
+ // these statements execute
+}
+</pre>
+
+<p>One reason to use {{jsxref("Operators/typeof", "typeof")}} is that it does not throw an error if the variable has not been declared.</p>
+
+<pre class="brush: js">// x has not been declared before
+if (typeof x === 'undefined') { // evaluates to true without errors
+ // these statements execute
+}
+
+if (x === undefined) { // throws a ReferenceError
+
+}
+</pre>
+
+<p>However, this kind of technique should be avoided. JavaScript is a statically scoped language, so knowing if a variable is declared can be read by seeing whether it is declared in an enclosing context. The only exception is the global scope, but the global scope is bound to the global object, so checking the existence of a variable in the global context can be done by checking the existence of a property on the <em>global object</em> (using the {{jsxref("Operators/in", "in")}} operator, for instance).</p>
+
+<h3 id="Void_operator_and_undefined"><code>Void</code> operator and <code>undefined</code></h3>
+
+<p>The {{jsxref("Operators/void", "void")}} operator is a third alternative.</p>
+
+<pre class="brush: js">var x;
+if (x === void 0) {
+ // these statements execute
+}
+
+// y has not been declared before
+if (y === void 0) {
+ // throws a - Uncaught ReferenceError: y is not defined
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-4.3.9', 'undefined')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.3.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.1.1.3', 'undefined')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-undefined', 'undefined')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-undefined', 'undefined')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.undefined")}}</p>
diff --git a/files/zh-tw/web/javascript/reference/global_objects/urierror/index.html b/files/zh-tw/web/javascript/reference/global_objects/urierror/index.html
new file mode 100644
index 0000000000..be0bb96d13
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/global_objects/urierror/index.html
@@ -0,0 +1,131 @@
+---
+title: URIError
+slug: Web/JavaScript/Reference/Global_Objects/URIError
+translation_of: Web/JavaScript/Reference/Global_Objects/URIError
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>URIError</strong></code> 物件在全域的URI處理函式被錯誤使用時作為一個錯誤被拋出。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>new URIError([<var>message</var>[, <var>fileName</var>[, <var>lineNumber</var>]]])</code></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>message</code></dt>
+ <dd>可選。具人類可讀性的錯誤說明</dd>
+ <dt><code>fileName</code> {{non-standard_inline}}</dt>
+ <dd>可選。包含造成錯誤發生的程式碼的檔案名稱</dd>
+ <dt><code>lineNumber</code> {{non-standard_inline}}</dt>
+ <dd>可選。造成錯誤發生的程式碼行號</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p><code>URIError</code> 在全域的URI處理函式被傳入了一個錯誤編碼的URI時被拋出。</p>
+
+<h2 id="屬性">屬性</h2>
+
+<dl>
+ <dt>{{jsxref("URIError.prototype")}}</dt>
+ <dd>允許對一個 <code>URIError</code> 物件增加其屬性。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p>普遍的 <code>URIError</code> 自身沒有包含方法,儘管他的確從原型鍊中繼承了一些。</p>
+
+<h2 id="URIError_物件實體"><code>URIError</code> 物件實體</h2>
+
+<h3 id="屬性_2">屬性</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError/prototype', 'Properties')}}</div>
+
+<h3 id="方法_2">方法</h3>
+
+<div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError/prototype', 'Methods')}}</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Catch_一個_URIError">Catch 一個 <code>URIError</code></h3>
+
+<pre class="brush: js">try {
+ decodeURIComponent('%');
+} catch (e) {
+ console.log(e instanceof URIError); // true
+ console.log(e.message); // "malformed URI sequence"
+ console.log(e.name); // "URIError"
+ console.log(e.fileName); // "Scratchpad/1"
+ console.log(e.lineNumber); // 2
+ console.log(e.columnNumber); // 2
+ console.log(e.stack); // "@Scratchpad/2:2:3\n"
+}
+</pre>
+
+<h3 id="生成一個_URIError">生成一個 <code>URIError</code></h3>
+
+<pre class="brush: js">try {
+ throw new URIError('Hello', 'someFile.js', 10);
+} catch (e) {
+ console.log(e instanceof URIError); // true
+ console.log(e.message); // "Hello"
+ console.log(e.name); // "URIError"
+ console.log(e.fileName); // "someFile.js"
+ console.log(e.lineNumber); // 10
+ console.log(e.columnNumber); // 0
+ console.log(e.stack); // "@Scratchpad/2:2:9\n"
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3', '#sec-15.11.6.6', 'URIError')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.11.6.6', 'URIError')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-native-error-types-used-in-this-standard-urierror', 'URIError')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-urierror', 'URIError')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.URIError")}}</p>
+</div>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li>{{jsxref("Error")}}</li>
+ <li>{{jsxref("URIError.prototype")}}</li>
+ <li>{{jsxref("Global_Objects/decodeURI", "decodeURI()")}}</li>
+ <li>{{jsxref("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}</li>
+ <li>{{jsxref("Global_Objects/encodeURI", "encodeURI()")}}</li>
+ <li>{{jsxref("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/index.html b/files/zh-tw/web/javascript/reference/index.html
new file mode 100644
index 0000000000..59367dbb12
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/index.html
@@ -0,0 +1,300 @@
+---
+title: JavaScript 參考文件
+slug: Web/JavaScript/Reference
+tags:
+ - JavaScript
+ - NeedsTranslation
+translation_of: Web/JavaScript/Reference
+---
+<div>{{JsSidebar}}</div>
+
+<p>在 MDN 的 JavaScript 分區中,這一部分被作爲 Javascript 的資料庫。閱讀<a href="https://wiki.developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/About">關於該參考</a>以了解更多。</p>
+
+<h2 id="全域物件">全域物件</h2>
+
+<p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects">JavaScript 標準內建物件</a> 以及其方法與屬性。</p>
+
+<ul class="card-grid">
+ <li><span>數值屬性</span>
+
+ <p>{{JSxRef("Infinity")}}<br>
+ {{JSxRef("NaN")}}<br>
+ {{JSxRef("undefined")}}<br>
+ {{JSxRef("globalThis")}}</p>
+ </li>
+ <li><span>函數屬性</span>
+ <p>{{JSxRef("Global_Objects/eval", "eval()")}}<br>
+ {{JSxRef("Global_Objects/isFinite", "isFinite()")}}<br>
+ {{JSxRef("Global_Objects/isNaN", "isNaN()")}}<br>
+ {{JSxRef("Global_Objects/parseFloat", "parseFloat()")}}<br>
+ {{JSxRef("Global_Objects/parseInt", "parseInt()")}}<br>
+ {{JSxRef("Global_Objects/decodeURI", "decodeURI()")}}<br>
+ {{JSxRef("Global_Objects/decodeURIComponent", "decodeURIComponent()")}}<br>
+ {{JSxRef("Global_Objects/encodeURI", "encodeURI()")}}<br>
+ {{JSxRef("Global_Objects/encodeURIComponent", "encodeURIComponent()")}}</p>
+ </li>
+ <li><span>基礎物件</span>
+ <p>{{JSxRef("Object")}}<br>
+ {{JSxRef("Function")}}<br>
+ {{JSxRef("Boolean")}}<br>
+ {{JSxRef("Symbol")}}</p>
+ </li>
+ <li><span>Error objects</span>
+ <p>{{JSxRef("Error")}}<br>
+ {{JSxRef("AggregateError")}}<br>
+ {{JSxRef("EvalError")}}<br>
+ {{JSxRef("InternalError")}}<br>
+ {{JSxRef("RangeError")}}<br>
+ {{JSxRef("ReferenceError")}}<br>
+ {{JSxRef("SyntaxError")}}<br>
+ {{JSxRef("TypeError")}}<br>
+ {{JSxRef("URIError")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>數字與日期</span>
+
+ <p>{{JSxRef("Number")}}<br>
+ {{JSxRef("BigInt")}}<br>
+ {{JSxRef("Math")}}<br>
+ {{JSxRef("Date")}}</p>
+ </li>
+ <li><span>文字處理</span>
+ <p>{{JSxRef("String")}}<br>
+ {{JSxRef("RegExp")}}</p>
+ </li>
+ <li><span>具索引的集合</span><a href="/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates#Numbers"> </a>{{JSxRef("Array")}}<br>
+ {{JSxRef("Int8Array")}}<br>
+ {{JSxRef("Uint8Array")}}<br>
+ {{JSxRef("Uint8ClampedArray")}}<br>
+ {{JSxRef("Int16Array")}}<br>
+ {{JSxRef("Uint16Array")}}<br>
+ {{JSxRef("Int32Array")}}<br>
+ {{JSxRef("Uint32Array")}}<br>
+ {{JSxRef("Float32Array")}}<br>
+ {{JSxRef("Float64Array")}}<br>
+ {{JSxRef("BigInt64Array")}}<br>
+ {{JSxRef("BigUint64Array")}}</li>
+ <li><span>具鍵值的集合</span>
+ <p>{{JSxRef("Map")}}<br>
+ {{JSxRef("Set")}}<br>
+ {{JSxRef("WeakMap")}}<br>
+ {{JSxRef("WeakSet")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>結構化資料</span>
+
+ <p>{{JSxRef("ArrayBuffer")}}<br>
+ {{JSxRef("SharedArrayBuffer")}}<br>
+ {{JSxRef("Atomics")}}<br>
+ {{JSxRef("DataView")}}<br>
+ {{JSxRef("JSON")}}</p>
+ </li>
+ <li><span>控制抽象化物件</span>
+ <p>{{JSxRef("Promise")}}<br>
+ {{JSxRef("Generator")}}<br>
+ {{JSxRef("GeneratorFunction")}}<br>
+ {{JSxRef("AsyncFunction")}}</p>
+ </li>
+ <li><span>Reflection</span>
+ <p>{{JSxRef("Reflect")}}<br>
+ {{JSxRef("Proxy")}}</p>
+ </li>
+ <li><span>國際化</span>
+ <p>{{JSxRef("Intl")}}<br>
+ {{JSxRef("Global_Objects/Collator", "Intl.Collator")}}<br>
+ {{JSxRef("Global_Objects/DateTimeFormat", "Intl.DateTimeFormat")}}<br>
+ {{JSxRef("Global_Objects/ListFormat", "Intl.ListFormat")}}<br>
+ {{JSxRef("Global_Objects/NumberFormat", "Intl.NumberFormat")}}<br>
+ {{JSxRef("Global_Objects/PluralRules", "Intl.PluralRules")}}<br>
+ {{JSxRef("Global_Objects/RelativeTimeFormat", "Intl.RelativeTimeFormat")}}<br>
+ {{JSxRef("Global_Objects/Locale", "Intl.Locale")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>WebAssembly</span>
+
+ <p>{{JSxRef("WebAssembly")}}<br>
+ {{JSxRef("WebAssembly.Module")}}<br>
+ {{JSxRef("WebAssembly.Instance")}}<br>
+ {{JSxRef("WebAssembly.Memory")}}<br>
+ {{JSxRef("WebAssembly.Table")}}<br>
+ {{JSxRef("WebAssembly.CompileError")}}<br>
+ {{JSxRef("WebAssembly.LinkError")}}<br>
+ {{JSxRef("WebAssembly.RuntimeError")}}</p>
+ </li>
+</ul>
+
+<h2 id="敘述句">敘述句</h2>
+
+<p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Statements">JavaScript 敘述句與宣告</a>。</p>
+
+<ul class="card-grid">
+ <li><span>流程控制</span>{{jsxref("Statements/block", "Block")}}<br>
+ {{jsxref("Statements/break", "break")}}<br>
+ {{jsxref("Statements/continue", "continue")}}<br>
+ {{jsxref("Statements/Empty", "Empty")}}<br>
+ {{jsxref("Statements/if...else", "if...else")}}<br>
+ {{jsxref("Statements/switch", "switch")}}<br>
+ {{jsxref("Statements/throw", "throw")}}<br>
+ {{jsxref("Statements/try...catch", "try...catch")}}</li>
+ <li><span>宣告</span>
+ <p>{{jsxref("Statements/var", "var")}}<br>
+ {{jsxref("Statements/let", "let")}}<br>
+ {{jsxref("Statements/const", "const")}}</p>
+ </li>
+ <li><span>函數與類別</span>
+ <p>{{jsxref("Statements/function", "function")}}<br>
+ {{jsxref("Statements/function*", "function*")}}<br>
+ {{jsxref("Statements/async_function", "async function")}}<br>
+ {{jsxref("Statements/return", "return")}}<br>
+ {{jsxref("Statements/class", "class")}}</p>
+ </li>
+ <li><span>迭代</span>
+ <p>{{jsxref("Statements/do...while", "do...while")}}<br>
+ {{jsxref("Statements/for", "for")}}<br>
+ {{jsxref("Statements/for_each...in", "for each...in")}}<br>
+ {{jsxref("Statements/for...in", "for...in")}}<br>
+ {{jsxref("Statements/for...of", "for...of")}}<br>
+ {{jsxref("Statements/for-await...of", "for await...of")}}<br>
+ {{jsxref("Statements/while", "while")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>Other</span>
+
+ <p>{{jsxref("Statements/debugger", "debugger")}}<br>
+ {{jsxref("Statements/import", "import")}}<br>
+ {{jsxref("Statements/label", "label")}}<br>
+ {{jsxref("Statements/with", "with")}}</p>
+ </li>
+</ul>
+
+<h2 id="表示法與運算子">表示法與運算子</h2>
+
+<p>本章節記錄了所有 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators">JavaScript 表示法與運算子</a>。</p>
+
+<div>
+<ul class="card-grid">
+ <li><span>主要運算式</span>{{JSxRef("Operators/this", "this")}}<br>
+ {{JSxRef("Operators/function", "function")}}<br>
+ {{JSxRef("Operators/class", "class")}}<br>
+ {{JSxRef("Operators/function*", "function*")}}<br>
+ {{JSxRef("Operators/yield", "yield")}}<br>
+ {{JSxRef("Operators/yield*", "yield*")}}<br>
+ {{JSxRef("Operators/async_function", "async function")}}<br>
+ {{JSxRef("Operators/await", "await")}}<br>
+ {{JSxRef("Global_Objects/Array", "[]")}}<br>
+ {{JSxRef("Operators/Object_initializer", "{}")}}<br>
+ {{JSxRef("Global_Objects/RegExp", "/ab+c/i")}}<br>
+ {{JSxRef("Operators/Grouping", "( )")}}<br>
+ {{JSxRef("null")}}</li>
+ <li><span>左手邊運算式</span>
+ <p>{{JSxRef("Operators/Property_accessors", "Property accessors", "", 1)}}<br>
+ {{JSxRef("Operators/new", "new")}}<br>
+ {{JSxRef("Operators/new%2Etarget", "new.target")}}<br>
+ {{JSxRef("Operators/super", "super")}}<br>
+ {{JSxRef("Operators/Spread_syntax", "...obj")}}</p>
+ </li>
+ <li><span>遞增與遞減</span>
+ <p>{{JSxRef("Operators/Arithmetic_Operators", "A++", "#Increment")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "A--", "#Decrement")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "++A", "#Increment")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "--A", "#Decrement")}}</p>
+ </li>
+ <li><span>一元運算子</span>
+ <p>{{JSxRef("Operators/delete", "delete")}}<br>
+ {{JSxRef("Operators/void", "void")}}<br>
+ {{JSxRef("Operators/typeof", "typeof")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "+", "#Unary_plus")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "-", "#Unary_negation")}}<br>
+ {{JSxRef("Operators/Bitwise_Operators", "~", "#Bitwise_NOT")}}<br>
+ {{JSxRef("Operators/Logical_Operators", "!", "#Logical_NOT")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>算術運算子</span>
+
+ <p>{{JSxRef("Operators/Arithmetic_Operators", "+", "#Addition")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "-", "#Subtraction")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "/", "#Division")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "*", "#Multiplication")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "%", "#Remainder")}}<br>
+ {{JSxRef("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}</p>
+ </li>
+ <li><span>關係運算子</span>
+ <p>{{JSxRef("Operators/in", "in")}}<br>
+ {{JSxRef("Operators/instanceof", "instanceof")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "&lt;", "#Less_than_operator")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "&gt;", "#Greater_than_operator")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "&lt;=", "#Less_than_or_equal_operator")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "&gt;=", "#Greater_than_or_equal_operator")}}</p>
+ </li>
+ <li><span>相等運算子</span>
+ <p>{{JSxRef("Operators/Comparison_Operators", "==", "#Equality")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "!=", "#Inequality")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "===", "#Identity")}}<br>
+ {{JSxRef("Operators/Comparison_Operators", "!==", "#Nonidentity")}}</p>
+ </li>
+ <li><span>位元移位運算子</span>
+ <p>{{JSxRef("Operators/Bitwise_Operators", "&lt;&lt;", "#Left_shift")}}<br>
+ {{JSxRef("Operators/Bitwise_Operators", "&gt;&gt;", "#Right_shift")}}<br>
+ {{JSxRef("Operators/Bitwise_Operators", "&gt;&gt;&gt;", "#Unsigned_right_shift")}}</p>
+ </li>
+</ul>
+
+<ul class="card-grid">
+ <li><span>二元位元運算子</span>{{JSxRef("Operators/Bitwise_Operators", "&amp;", "#Bitwise_AND")}}<br>
+ {{JSxRef("Operators/Bitwise_Operators", "|", "#Bitwise_OR")}}<br>
+ {{JSxRef("Operators/Bitwise_Operators", "^", "#Bitwise_XOR")}}</li>
+ <li><span>二元邏輯運算子</span>
+ <p>{{JSxRef("Operators/Logical_Operators", "&amp;&amp;", "#Logical_AND")}}<br>
+ {{JSxRef("Operators/Logical_Operators", "||", "#Logical_OR")}}</p>
+ </li>
+ <li><span>條件(三元)運算子</span>
+ <p>{{JSxRef("Operators/Conditional_Operator", "(condition ? ifTrue : ifFalse)")}}</p>
+ </li>
+ <li><span>賦值運算子</span>
+ <p>{{JSxRef("Operators/Assignment_Operators", "=", "#Assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "*=", "#Multiplication_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "/=", "#Division_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "%=", "#Remainder_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "+=", "#Addition_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "-=", "#Subtraction_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "&lt;&lt;=", "#Left_shift_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "&gt;&gt;=", "#Right_shift_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "&gt;&gt;&gt;=", "#Unsigned_right_shift_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "&amp;=", "#Bitwise_AND_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "^=", "#Bitwise_XOR_assignment")}}<br>
+ {{JSxRef("Operators/Assignment_Operators", "|=", "#Bitwise_OR_assignment")}}<br>
+ {{JSxRef("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}}<br>
+ {{JSxRef("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}}</p>
+ </li>
+</ul>
+</div>
+
+<h2 id="函數">函數</h2>
+
+<p>本章節說明如何使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions">JavaScript 函數</a> 來開發您的應用程式。</p>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/arguments"><code>arguments</code></a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Default_parameters">Default parameters</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">Rest parameters</a></li>
+</ul>
+
+<h2 id="其他參考頁面">其他參考頁面</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Lexical_grammar">Lexical grammar</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Data_structures">Data types and data structures</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">Strict mode</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features">Deprecated features</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/iteration_protocols/index.html b/files/zh-tw/web/javascript/reference/iteration_protocols/index.html
new file mode 100644
index 0000000000..707da81524
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/iteration_protocols/index.html
@@ -0,0 +1,351 @@
+---
+title: 迭代協議
+slug: Web/JavaScript/Reference/Iteration_protocols
+tags:
+ - ECMAScript 2015
+ - Intermediate
+ - Iterator
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Iteration_protocols
+---
+<div>{{jsSidebar("More")}}</div>
+
+<p>為 ECMAScript 2015 中的一些補充內容,並非新的內建物件或語法,而是協議。這些協議可被任何遵守特定協定的物件所實作。</p>
+
+<p>本文介紹兩種協議:<a href="#The_iterable_protocol">可迭代協議(iterable protocol)</a>以及<a href="#The_iterator_protocol">迭代器協議(iterator protocol)</a>。</p>
+
+<h2 id="可迭代協議">可迭代協議</h2>
+
+<p><strong>可迭代(iterable)</strong>協議允許 JavaScript 物件定義或客制他們的迭代行為,例如哪些值可在 {{jsxref("Statements/for...of", "for..of")}} 語法結構中被迭代出來。部分內建型別為擁有預設迭代行為的<a href="#Built-in_iterables">可迭代內建物件(built-in iterables)</a>,如 {{jsxref("Array")}} 或 {{jsxref("Map")}},而其他型別(如 {{jsxref("Object")}})則否。</p>
+
+<p>為了成為<strong>可迭代的(iterable)</strong>,一個物件必須實作 <strong>@@iterator</strong> 方法,意思是這個物件(或其<a href="/zh-TW/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain">原型鏈</a>中的其中一個原型物件)必須擁有一個鍵(key)值為 <strong>@@iterator</strong>(即 {{jsxref("Symbol.iterator")}} 常數)的屬性:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">屬性</th>
+ <th scope="col">值</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>[Symbol.iterator]</code></td>
+ <td>回傳符合<a href="#The_iterator_protocol">迭代器協議(iterator protocol)</a>之物件的無引數函式。</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>每當物件需要被迭代時(比如在一個開始的 <code>for..of</code> 迴圈中),物件的 <code>@@iterator</code> 方法會被以不傳入引數的方式呼叫,並會使用其回傳的<strong>迭代器(iterator)</strong>來獲得被迭代出來的值。</p>
+
+<h2 id="迭代器協議">迭代器協議</h2>
+
+<p><strong>迭代器(iterator)</strong>協議定義了一個標準方式來產出一連串(有限或無限)的值,並且可能於所有值都被產出後回傳一個值。</p>
+
+<p>當物件以下列語義實作了 <code><strong>next()</strong></code> 方法即為一個迭代器:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">屬性</th>
+ <th scope="col">值</th>
+ </tr>
+ <tr>
+ <td><code>next</code></td>
+ <td>
+ <p>回傳一個至少擁有以下兩個屬性之物件的無引數函式:</p>
+
+ <ul>
+ <li><code>done</code>(布林值)
+
+ <ul>
+ <li>若迭代器已迭代完畢整個可迭代序列,則值為 <code>true</code>。在這個情況下 <code>value</code> 可以是代表迭代器的<em>回傳值</em>。</li>
+ <li>若迭代器能夠產出序列中的下一個值,則值為 <code>false</code>。相當於完全不指定 <code>done</code> 屬性。</li>
+ </ul>
+ </li>
+ <li><code>value</code> - 任何由迭代器所回傳的 JavaScript 值。可於 <code>done</code> 為 <code>true</code> 時省略。</li>
+ </ul>
+
+ <p><code>next</code> 方法必須總是回傳一個包含符合 <code>done</code> 及 <code>value</code> 屬性的物件。假如回傳了一個非物件值(如 <code>false</code> 或 <code>undefined</code>),則將會拋出一個 {{jsxref("TypeError")}} 錯誤。</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<div class="note">
+<p>我們無法反射性的一眼看出一個特定的物件是否實作了迭代器協議,然而要建立一個同時滿足迭代器及可迭代協議的物件卻是相當容易(如下例所示)。範例的做法允許一個迭代器被各個預期其可迭代行為的語法所消費。因此很少有需要實作迭代器協議而沒有實作可迭代協議的情況。</p>
+
+<pre class="brush: js">var myIterator = {
+  next: function() {
+  // ...
+ },
+  [Symbol.iterator]: function() { return this }
+};
+</pre>
+</div>
+
+<h2 id="迭代協議使用範例">迭代協議使用範例</h2>
+
+<p>{{jsxref("String")}} 為一個可迭代內建物件(built-in iterable object)的範例:</p>
+
+<pre class="brush: js">var someString = 'hi';
+typeof someString[Symbol.iterator]; // "function"
+</pre>
+
+<p><code>String</code> 的<a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/String/@@iterator">預設迭代器</a>會回傳字串中的一個一個字元:</p>
+
+<pre class="brush: js">var iterator = someString[Symbol.iterator]();
+iterator + ''; // "[object String Iterator]"
+
+iterator.next(); // { value: "h", done: false }
+iterator.next(); // { value: "i", done: false }
+iterator.next(); // { value: undefined, done: true }</pre>
+
+<p>部分內建語法結構(built-in constructs),如 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Spread_operator">spread syntax</a>,其內部也使用了相同的迭代協議:</p>
+
+<pre class="brush: js">[...someString] // ["h", "i"]</pre>
+
+<p>我們可以藉由提供我們自己的 <code>@@iterator</code> 來重新定義迭代行為:</p>
+
+<pre class="brush: js">var someString = new String('hi'); // need to construct a String object explicitly to avoid auto-boxing
+
+someString[Symbol.iterator] = function() {
+ return { // this is the iterator object, returning a single element, the string "bye"
+ next: function() {
+ if (this._first) {
+ this._first = false;
+ return { value: 'bye', done: false };
+ } else {
+ return { done: true };
+ }
+ },
+ _first: true
+ };
+};
+</pre>
+
+<p>請注意,重新定義 <code>@@iterator</code> 會影響使用迭代協議之內建語法結構的行為:</p>
+
+<pre class="brush: js">[...someString]; // ["bye"]
+someString + ''; // "hi"
+</pre>
+
+<h2 id="可迭代範例">可迭代範例</h2>
+
+<h3 id="可迭代內建物件">可迭代內建物件</h3>
+
+<p>{{jsxref("String")}}、{{jsxref("Array")}}、{{jsxref("TypedArray")}}、{{jsxref("Map")}} 以及 {{jsxref("Set")}} 全都是可迭代內建物件,因為他們每一個的原型物件皆實作了 <code>@@iterator</code> 方法。</p>
+
+<h3 id="自定義可迭代物件">自定義可迭代物件</h3>
+
+<p>我們可以建立自己的可迭代物件,像是:</p>
+
+<pre class="brush: js">var myIterable = {};
+myIterable[Symbol.iterator] = function* () {
+ yield 1;
+ yield 2;
+ yield 3;
+};
+[...myIterable]; // [1, 2, 3]
+</pre>
+
+<h3 id="接受可迭代物件的內建_APIs">接受可迭代物件的內建 APIs</h3>
+
+<p>有許多 APIs 接受可迭代物件,如:{{jsxref("Map", "Map([iterable])")}}、{{jsxref("WeakMap", "WeakMap([iterable])")}}、{{jsxref("Set", "Set([iterable])")}} 及 {{jsxref("WeakSet", "WeakSet([iterable])")}}:</p>
+
+<pre class="brush: js">var myObj = {};
+new Map([[1, 'a'], [2, 'b'], [3, 'c']]).get(2); // "b"
+new WeakMap([[{}, 'a'], [myObj, 'b'], [{}, 'c']]).get(myObj); // "b"
+new Set([1, 2, 3]).has(3); // true
+new Set('123').has('2'); // true
+new WeakSet(function* () {
+ yield {};
+ yield myObj;
+ yield {};
+}()).has(myObj); // true
+</pre>
+
+<p>另外可參考 {{jsxref("Promise.all", "Promise.all(iterable)")}}、{{jsxref("Promise.race", "Promise.race(iterable)")}} 以及 {{jsxref("Array.from", "Array.from()")}}。</p>
+
+<h3 id="用於可迭代物件的語法">用於可迭代物件的語法</h3>
+
+<p>部分陳述式(statements)及運算式(expressions)為預期用於可迭代物件,例如 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/for...of">for-of</a></code> 迴圈、<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Spread_operator">spread syntax</a>、<code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/yield*">yield*</a></code>,及<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">解構賦值</a>:</p>
+
+<pre class="brush: js">for(let value of ['a', 'b', 'c']){
+ console.log(value);
+}
+// "a"
+// "b"
+// "c"
+
+[...'abc']; // ["a", "b", "c"]
+
+function* gen() {
+ yield* ['a', 'b', 'c'];
+}
+
+gen().next(); // { value:"a", done:false }
+
+[a, b, c] = new Set(['a', 'b', 'c']);
+a // "a"
+
+</pre>
+
+<h3 id="非良好的(Non-well-formed)可迭代物件">非良好的(Non-well-formed)可迭代物件</h3>
+
+<p>假如可迭件物件的 <code>@@iterator</code> 方法不是回傳一個迭代器物件,即是非良好的(non-well-formed)可迭代物件。如以下方式使用可能會導致執行時期異常或錯誤行為:</p>
+
+<pre class="brush: js">var nonWellFormedIterable = {}
+nonWellFormedIterable[Symbol.iterator] = () =&gt; 1
+[...nonWellFormedIterable] // TypeError: [] is not a function
+</pre>
+
+<h2 id="迭代器範例">迭代器範例</h2>
+
+<h3 id="簡單的迭代器">簡單的迭代器</h3>
+
+<pre class="brush: js">function makeIterator(array) {
+ var nextIndex = 0;
+
+ return {
+ next: function() {
+ return nextIndex &lt; array.length ?
+ {value: array[nextIndex++], done: false} :
+ {done: true};
+ }
+ };
+}
+
+var it = makeIterator(['yo', 'ya']);
+
+console.log(it.next().value); // 'yo'
+console.log(it.next().value); // 'ya'
+console.log(it.next().done); // true
+</pre>
+
+<h3 id="無限迭代器">無限迭代器</h3>
+
+<pre class="brush: js">function idMaker() {
+ var index = 0;
+
+ return {
+ next: function(){
+ return {value: index++, done: false};
+ }
+ };
+}
+
+var it = idMaker();
+
+console.log(it.next().value); // '0'
+console.log(it.next().value); // '1'
+console.log(it.next().value); // '2'
+// ...
+</pre>
+
+<h3 id="搭配生成器(generator)">搭配生成器(generator)</h3>
+
+<pre class="brush: js">function* makeSimpleGenerator(array) {
+ var nextIndex = 0;
+
+ while (nextIndex &lt; array.length) {
+ yield array[nextIndex++];
+ }
+}
+
+var gen = makeSimpleGenerator(['yo', 'ya']);
+
+console.log(gen.next().value); // 'yo'
+console.log(gen.next().value); // 'ya'
+console.log(gen.next().done); // true
+
+
+
+function* idMaker() {
+ var index = 0;
+ while (true)
+ yield index++;
+}
+
+var gen = idMaker();
+
+console.log(gen.next().value); // '0'
+console.log(gen.next().value); // '1'
+console.log(gen.next().value); // '2'
+// ...
+</pre>
+
+<h3 id="搭配_ES2015_類別">搭配 ES2015 類別</h3>
+
+<pre class="brush: js">class SimpleClass {
+ constructor(data) {
+ this.index = 0;
+ this.data = data;
+ }
+
+ [Symbol.iterator]() {
+ return {
+ next: () =&gt; {
+ if (this.index &lt; this.data.length) {
+ return {value: this.data[this.index++], done: false};
+ } else {
+ this.index = 0; //If we would like to iterate over this again without forcing manual update of the index
+ return {done: true};
+ }
+ }
+ }
+ };
+}
+
+const simple = new SimpleClass([1,2,3,4,5]);
+
+for (const val of simple) {
+ console.log(val); //'0' '1' '2' '3' '4' '5'
+}
+</pre>
+
+<h2 id="生成器物件是迭代器還是可迭代物件?">生成器物件是迭代器還是可迭代物件?</h2>
+
+<p><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Generator">生成器物件(generator object)</a>同時為迭代器及可迭代物件:</p>
+
+<pre class="brush: js">var aGeneratorObject = function* () {
+ yield 1;
+ yield 2;
+ yield 3;
+}();
+typeof aGeneratorObject.next;
+// "function", because it has a next method, so it's an iterator
+typeof aGeneratorObject[Symbol.iterator];
+// "function", because it has an @@iterator method, so it's an iterable
+aGeneratorObject[Symbol.iterator]() === aGeneratorObject;
+// true, because its @@iterator method returns itself (an iterator), so it's an well-formed iterable
+[...aGeneratorObject];
+// [1, 2, 3]
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-iteration', 'Iteration')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-iteration', 'Iteration')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>更多關於 ES2015 生成器(generators)的資訊,可參考<a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/function*">生成器函式 function* 文件</a>。</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/lexical_grammar/index.html b/files/zh-tw/web/javascript/reference/lexical_grammar/index.html
new file mode 100644
index 0000000000..80c760f20c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/lexical_grammar/index.html
@@ -0,0 +1,548 @@
+---
+title: Lexical grammar
+slug: Web/JavaScript/Reference/Lexical_grammar
+translation_of: Web/JavaScript/Reference/Lexical_grammar
+---
+<div>
+<p>{{JsSidebar("More")}}</p>
+
+<p>此篇介紹 Javascript 的lexical grammar。ECMAScript 的原始碼從左到右被掃描並被轉換成一系列的輸入元素也就是 token、控制字元、行終止字元、註解或是空白字元。ECMAScript 也定義了一些特定的關鍵字和實體語法還有用來自動插入分號來結束陳述式的規則。</p>
+
+<h2 id="控制字元">控制字元</h2>
+
+<p>控制字元是用來控制對文本的解釋,但無法被顯示出來。</p>
+
+<table class="standard-table">
+ <caption>Unicode 格式的控制字元</caption>
+ <tbody>
+ <tr>
+ <th><strong>編碼位置</strong></th>
+ <th>名稱</th>
+ <th>縮寫</th>
+ <th>說明</th>
+ </tr>
+ <tr>
+ <td><code>U+200C</code></td>
+ <td>零寬不連字</td>
+ <td>&lt;ZWNJ&gt;</td>
+ <td>放置在兩個字元之間來避免在某些語言中這兩個字元被當成連字 (<a href="http://en.wikipedia.org/wiki/Zero-width_non-joiner">Wikipedia</a>)</td>
+ </tr>
+ <tr>
+ <td><code>U+200D</code></td>
+ <td>零寬連字</td>
+ <td>&lt;ZWJ&gt;</td>
+ <td>放置在兩個通常不會發生連字的字元中間在某些語言<br>
+ 來讓他們成為連字 (<a href="http://en.wikipedia.org/wiki/Zero-width_joiner">Wikipedia</a>)</td>
+ </tr>
+ <tr>
+ <td><code>U+FEFF</code></td>
+ <td>位元組順序記號</td>
+ <td>&lt;BOM&gt;</td>
+ <td>出現在腳本的開頭,用來標記此腳本是否為Unicode還有文本的位元組順序<br>
+  (<a href="http://en.wikipedia.org/wiki/Byte_order_mark">Wikipedia</a>)</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="空白字元">空白字元</h2>
+
+<p>空白字元提升了程式碼的可讀性也能將 tokens 分開。這些字元通常對程式的執行是不必要的。<a href="http://en.wikipedia.org/wiki/Minification_%28programming%29">壓縮源碼工具</a>通常會移除不必要的空白來減少資料傳輸量。</p>
+
+<table class="standard-table">
+ <caption>空白字元</caption>
+ <tbody>
+ <tr>
+ <th><strong>編碼位置</strong></th>
+ <th>名稱</th>
+ <th>縮寫</th>
+ <th>說明</th>
+ <th>跳脫字元</th>
+ </tr>
+ <tr>
+ <td>U+0009</td>
+ <td>定位字元</td>
+ <td>&lt;HT&gt;</td>
+ <td>橫向定位字元</td>
+ <td>\t</td>
+ </tr>
+ <tr>
+ <td>U+000B</td>
+ <td>縱向定位字元</td>
+ <td>&lt;VT&gt;</td>
+ <td>縱向定位字元</td>
+ <td>\v</td>
+ </tr>
+ <tr>
+ <td>U+000C</td>
+ <td>換頁字元</td>
+ <td>&lt;FF&gt;</td>
+ <td>控制換頁字元 (<a href="http://en.wikipedia.org/wiki/Page_break#Form_feed">Wikipedia</a>)</td>
+ <td>\f</td>
+ </tr>
+ <tr>
+ <td>U+0020</td>
+ <td>空格</td>
+ <td>&lt;SP&gt;</td>
+ <td>一般的空白字元</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>U+00A0</td>
+ <td>不中斷空格</td>
+ <td>&lt;NBSP&gt;</td>
+ <td>一般的空白字元,但禁止自動換行或合併多個空白 (<a href="https://en.wikipedia.org/wiki/Non-breaking_space">Wikipedia</a>)</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>其他</td>
+ <td>其他Unicode空白字元</td>
+ <td>&lt;USP&gt;</td>
+ <td><a href="http://en.wikipedia.org/wiki/Space_%28punctuation%29#Spaces_in_Unicode">Wikipedia</a></td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="行終止字元">行終止字元</h2>
+
+<p>除了空白字元之外,行終止字元也用來提升源碼可讀性。然而,在某些情況下行終止字元會影響 Javascript 程式的執行,所以有些地方是被禁止使用的。行終止字元同時也會影響<a href="#Automatic_semicolon_insertion">自動插入分號</a>的運作。在<a href="/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">正規表達式</a>中,行終止字元屬於 <strong>\s</strong> 的類別。</p>
+
+<p>在 ECMAScript 中,只有以下的Unicode碼位被視為行終止字元,其他如 Next Line, NEL, U+0085 等的行終止字元被視為空白字元。</p>
+
+<table class="standard-table">
+ <caption>行終止字元</caption>
+ <tbody>
+ <tr>
+ <th><strong>編碼位置</strong></th>
+ <th>名稱</th>
+ <th>縮寫</th>
+ <th>說明</th>
+ <th>跳脫字元</th>
+ </tr>
+ <tr>
+ <td>U+000A</td>
+ <td>換行字元</td>
+ <td>&lt;LF&gt;</td>
+ <td>在 UNIX 類的系統中的換行字元</td>
+ <td>\n</td>
+ </tr>
+ <tr>
+ <td>U+000D</td>
+ <td>歸位字元</td>
+ <td>&lt;CR&gt;</td>
+ <td>在 Commodore 與早期的 Mac 系統中的換行字元</td>
+ <td>\r</td>
+ </tr>
+ <tr>
+ <td>U+2028</td>
+ <td>行分隔字元</td>
+ <td>&lt;LS&gt;</td>
+ <td><a href="http://en.wikipedia.org/wiki/Newline">Wikipedia</a></td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>U+2029</td>
+ <td>段分隔字元</td>
+ <td>&lt;PS&gt;</td>
+ <td><a href="http://en.wikipedia.org/wiki/Newline">Wikipedia</a></td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="註解">註解</h2>
+
+<p>在 Javascript 程式中,註解通常被用來寫提示、註釋、建議或警告。這可以讓程式更好讀也更好理解,同時也是一個很好的除錯工具,可以讓一些程式碼不被執行。</p>
+
+<p>Javascript 有兩種方式寫註解。</p>
+
+<p>第一種是 <code>//</code>; 它將在它之後的文本變成註解。例如:</p>
+
+<pre class="brush: js">function comment() {
+  // 這是一行 Javascript 註解
+  console.log('Hello world!');
+}
+comment();
+</pre>
+
+<p>第二種更有彈性的方式是 <code>/* */</code> 。</p>
+
+<p>例如,你可以將它用在單行上:</p>
+
+<pre class="brush: js">function comment() {
+  /* 這是一行 Javascript 註解 */
+  console.log('Hello world!');
+}
+comment();</pre>
+
+<p>你也可以將它用來寫多行註解:</p>
+
+<pre class="brush: js">function comment() {
+  /* 這個註解可以跨越多行。注意只有當我們要結束註解時才寫
+  多行註解的終止符號 */
+  console.log('Hello world!');
+}
+comment();</pre>
+
+<p>如果你想要你也可以把它插在一行的中央,雖然它會讓你的程式變得難讀所以請謹慎使用:</p>
+
+<pre class="brush: js">function comment(x) {
+  console.log('Hello ' + x /* 插入 x 的值 */ + ' !');
+}
+comment('world');</pre>
+
+<p>此外,你也可以把一段程式用註解包起來讓它不被執行:</p>
+
+<pre class="brush: js">function comment() {
+  /* console.log('Hello world!'); */
+}
+comment();</pre>
+
+<p>在這個情況, <code>console.log()</code> 永遠不會被呼叫因為它在註解裡面。任意行數的程式碼都可以用這個方法來使之失去作用。</p>
+
+<h2 id="保留字">保留字</h2>
+
+<h3 id="ECMAScript_2015_保留關鍵字">ECMAScript 2015 保留關鍵字</h3>
+
+<ul class="threecolumns">
+ <li>{{jsxref("Statements/break", "break")}}</li>
+ <li>{{jsxref("Statements/switch", "case")}}</li>
+ <li>{{jsxref("Statements/try...catch", "catch")}}</li>
+ <li>{{jsxref("Statements/class", "class")}}</li>
+ <li>{{jsxref("Statements/const", "const")}}</li>
+ <li>{{jsxref("Statements/continue", "continue")}}</li>
+ <li>{{jsxref("Statements/debugger", "debugger")}}</li>
+ <li>{{jsxref("Statements/default", "default")}}</li>
+ <li>{{jsxref("Operators/delete", "delete")}}</li>
+ <li>{{jsxref("Statements/do...while", "do")}}</li>
+ <li>{{jsxref("Statements/if...else", "else")}}</li>
+ <li>{{jsxref("Statements/export", "export")}}</li>
+ <li>{{jsxref("Statements/class", "extends")}}</li>
+ <li>{{jsxref("Statements/try...catch", "finally")}}</li>
+ <li>{{jsxref("Statements/for", "for")}}</li>
+ <li>{{jsxref("Statements/function", "function")}}</li>
+ <li>{{jsxref("Statements/if...else", "if")}}</li>
+ <li>{{jsxref("Statements/import", "import")}}</li>
+ <li>{{jsxref("Operators/in", "in")}}</li>
+ <li>{{jsxref("Operators/instanceof", "instanceof")}}</li>
+ <li>{{jsxref("Operators/new", "new")}}</li>
+ <li>{{jsxref("Statements/return", "return")}}</li>
+ <li>{{jsxref("Operators/super", "super")}}</li>
+ <li>{{jsxref("Statements/switch", "switch")}}</li>
+ <li>{{jsxref("Operators/this", "this")}}</li>
+ <li>{{jsxref("Statements/throw", "throw")}}</li>
+ <li>{{jsxref("Statements/try...catch", "try")}}</li>
+ <li>{{jsxref("Operators/typeof", "typeof")}}</li>
+ <li>{{jsxref("Statements/var", "var")}}</li>
+ <li>{{jsxref("Operators/void", "void")}}</li>
+ <li>{{jsxref("Statements/while", "while")}}</li>
+ <li>{{jsxref("Statements/with", "with")}}</li>
+ <li>{{jsxref("Operators/yield", "yield")}}</li>
+</ul>
+
+<h3 id="未來保留關鍵字">未來保留關鍵字</h3>
+
+<p>根據 ECMAScript 的規格,以下的關鍵字被保留供未來使用。他們目前沒有功用但未來可能有,所以不能將他們用作識別字。</p>
+
+<p>以下關鍵字將永遠被保留:</p>
+
+<ul>
+ <li><code>enum</code></li>
+</ul>
+
+<p>以下關鍵字只有在嚴格模式底下才被保留:</p>
+
+<ul class="threecolumns">
+ <li><code>implements</code></li>
+ <li><code>interface</code></li>
+ <li>{{jsxref("Statements/let", "let")}}</li>
+ <li><code>package</code></li>
+ <li><code>private</code></li>
+ <li><code>protected</code></li>
+ <li><code>public</code></li>
+ <li><code>static</code></li>
+</ul>
+
+<p>以下關鍵字只有在出現在模組程式碼中時才被保留:</p>
+
+<ul>
+ <li><code>await</code></li>
+</ul>
+
+<h4 id="舊標準中的未來保留關鍵字">舊標準中的未來保留關鍵字</h4>
+
+<p>以下關鍵字在舊的 ECMAScript 規格中 (ECMAScript 1 到 3) 為未來保留關鍵:</p>
+
+<ul class="threecolumns">
+ <li><code>abstract</code></li>
+ <li><code>boolean</code></li>
+ <li><code>byte</code></li>
+ <li><code>char</code></li>
+ <li><code>double</code></li>
+ <li><code>final</code></li>
+ <li><code>float</code></li>
+ <li><code>goto</code></li>
+ <li><code>int</code></li>
+ <li><code>long</code></li>
+ <li><code>native</code></li>
+ <li><code>short</code></li>
+ <li><code>synchronized</code></li>
+ <li><code>throws</code></li>
+ <li><code>transient</code></li>
+ <li><code>volatile</code></li>
+</ul>
+
+<p>此外,如 <code>null</code>, <code>true</code> 與 <code>false</code> 等實體語法 (literal) 在 ECMAScript 中不能被用作識別字。</p>
+
+<h3 id="保留字的使用">保留字的使用</h3>
+
+<p>只有當用在識別字的時候保留關鍵字才會被保留 (相對於 <code>IdentifierNames</code>) 。如 <a href="http://es5.github.com/#A.1">es5.github.com/#A.1</a> 所述,以下保留關鍵字的用法都屬於<code>IdentifierNames</code> 因此是合法的。</p>
+
+<pre class="brush: js">a.import
+a['import']
+a = { import: 'test' }.
+</pre>
+
+<p>反之,以下用法不合法因為用在識別字上,識別字屬於 <code>IdentifierName</code> 但不包含保留字。識別字用在 <code>FunctionDeclaration, FunctionExpression, VariableDeclaration</code> 等等?。而 <code>IdentifierName</code> 被用在 <code>MemberExpression, CallExpression</code> 等等。</p>
+
+<pre class="brush: js">function import() {} // 不合法.</pre>
+
+<h2 id="實體語法">實體語法</h2>
+
+<h3 id="Null">Null</h3>
+
+<p>更多說明請參閱 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/null"><code>null</code></a> 。</p>
+
+<pre class="brush: js">null</pre>
+
+<h3 id="布林值">布林值</h3>
+
+<p>更多說明請參閱 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean"><code>Boolean</code></a> 。</p>
+
+<pre class="brush: js">true
+false</pre>
+
+<h3 id="數值">數值</h3>
+
+<h4 id="十進制">十進制</h4>
+
+<pre class="brush: js">1234567890
+42
+
+// 謹慎使用前導零
+0888 // 888 被解析成十進制
+0777 // 被解析成八進制, 十進制值為 511
+</pre>
+
+<p>數值的實體語法可以可以以零 (<code>0</code>) 為首再街上其他十進制數字。然而一但零後面的的數字都小於8時,這個數值會被解讀成八進制數字,這個行為不會丟出例外,請參閱 {{bug(957513)}}。也請參閱 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt#Octal_interpretations_with_no_radix"><code>parseInt()</code></a>。</p>
+
+<h4 id="二進制">二進制</h4>
+
+<p>二進制數字的語法為一個起首零加上小寫或大小的拉丁字元"B"  (<code>0b</code> 或 <code>0B</code>)。因為這個語法是在 ECMAScript 2015 才新增的,請參閱底下的瀏覽器相容表。如果 <code>0b</code> 之後的數字不是0或1,"0b之後找不到二進制數字"的 <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError">SyntaxError</a></code> 會被丟出。</p>
+
+<pre class="brush: js">var FLT_SIGNBIT = 0b10000000000000000000000000000000; // 2147483648
+var FLT_EXPONENT = 0b01111111100000000000000000000000; // 2139095040
+var FLT_MANTISSA = 0B00000000011111111111111111111111; // 8388607</pre>
+
+<h4 id="八進制">八進制</h4>
+
+<p>八進制數字的語法為一個起首零加上小寫或大小的拉丁字元"O"  (<code>0o</code> 或 <code>0B</code>)。因為這個語法是在 ECMAScript 2015 才新增的,請參閱底下的瀏覽器相容表。如果 <code>0o</code> 之後的數字不是 (01234567) 其中之一,"0o之後找不到八進制數字"的 SyntaxError 會被丟出。</p>
+
+<pre class="brush: js">var n = 0O755; // 493
+var m = 0o644; // 420
+
+// 也可以省略'o/O'只寫一個前導0 (參閱上面十進位的提醒)
+0755
+0644
+</pre>
+
+<h4 id="十六進制">十六進制</h4>
+
+<p>十六進制數字的語法為一個起首零加上小寫或大小的拉丁字元"X"  (<code>0x</code> 或 <code>0X</code>)。如果 <code>0x</code> 之後的數字不是 (0123456789ABCDEF) 其中之一,"識別字緊接在數值實體語法後"的 SyntaxError 會被丟出。</p>
+
+<pre class="brush: js">0xFFFFFFFFFFFFFFFFF // 295147905179352830000
+0x123456789ABCDEF // 81985529216486900
+0XA // 10
+</pre>
+
+<h3 id="物件">物件</h3>
+
+<p>更多說明請參閱 {{jsxref("Object")}} 及 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">Object initializer</a>。</p>
+
+<pre class="brush: js">var o = { a: 'foo', b: 'bar', c: 42 };
+
+// 簡短表示法 (ES2015 新增)
+var a = 'foo', b = 'bar', c = 42;
+var o = {a, b, c};
+
+// ES2015 以前必須這樣寫
+var o = { a: a, b: b, c: c };
+</pre>
+
+<h3 id="陣列">陣列</h3>
+
+<p>更多說明請參閱 {{jsxref("Array")}} 。</p>
+
+<pre class="brush: js">[1954, 1974, 1990, 2014]</pre>
+
+<h3 id="字串">字串</h3>
+
+<pre class="brush: js">'foo'
+"bar"</pre>
+
+<h4 id="十六進制跳脫序列">十六進制跳脫序列</h4>
+
+<pre class="brush: js">'\xA9' // "©"
+</pre>
+
+<h4 id="Unicode_跳脫序列">Unicode 跳脫序列</h4>
+
+<p>一個Unicode跳脫序列由 <code>\u</code> 接上4個十六進制的數值所組成。每一個十六進制的數值表示一個UTF-16編碼的2位元組字元。對於編碼位置在0~FFFF之間的字元,其Unicode表示法與編碼位置相同。而更高的編碼位置需要兩個跳脫序列來表示,又稱為代理對(surrogate pair),代理對表示的數值與編碼位置不同 (<a href="https://en.wikipedia.org/wiki/UTF-16">代理對計算規則wiki</a>)。</p>
+
+<pre class="brush: js">'\u00A9' // "©"
+</pre>
+
+<h4 id="Unicode_跳脫編碼位置">Unicode 跳脫編碼位置</h4>
+
+<p>ECMAScript 2015 新增。使用Unicode跳脫編碼位置表示法,即可使用與編碼位置完全相同的表示法 (最高到 <code>0x10FFFF</code>) 而不受編碼位置高於FFFF需用代理對表示的限制。</p>
+
+<p>更多說明請參閱 {{jsxref("String.fromCodePoint()")}} 或 {{jsxref("String.prototype.codePointAt()")}}。</p>
+
+<pre class="brush: js">'\u{2F804}'
+
+// 等價於代理對表示法
+'\uD87E\uDC04'</pre>
+
+<h3 id="正規表達式">正規表達式</h3>
+
+<p>更多說明請參閱  <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp"><code>RegExp</code></a> 。</p>
+
+<pre class="brush: js">/ab+c/g
+
+// 一個空的正規表示法。
+// 兩個斜線之間不得為空,否則將被視為單行註解。
+/(?:)/</pre>
+
+<h3 id="範本字串">範本字串</h3>
+
+<p>更多說明請參閱  <a href="/en-US/docs/Web/JavaScript/Reference/template_strings">template strings</a> 。</p>
+
+<pre class="brush: js">`string text`
+
+`string text line 1
+ string text line 2`
+
+`string text ${expression} string text`
+
+tag `string text ${expression} string text`</pre>
+
+<h2 id="自動插入分號">自動插入分號</h2>
+
+<p>否些 <a href="/en-US/docs/Web/JavaScript/Reference/Statements">JavaScript statements</a> 必須以分號作結,因此會受到自動插入分號 (ASI) 規則影響。</p>
+
+<ul>
+ <li>空運算式</li>
+ <li><code>let</code>, <code>const</code>, 變數宣告</li>
+ <li><code>import</code>, <code>export</code>, 模組宣告</li>
+ <li>運算式</li>
+ <li><code>debugger</code></li>
+ <li><code>continue</code>, <code>break</code>, <code>throw</code></li>
+ <li><code>return</code></li>
+</ul>
+
+<p>ECMAScript 規格闡明<a href="https://tc39.github.io/ecma262/#sec-rules-of-automatic-semicolon-insertion"> 自動插入分號的三個規則</a>。</p>
+
+<p>1.  如果 <a href="#Line_terminators">行終止字元</a> 或 "}" 出現在不符文法的地方,一個分號會被自動插入在其之前。</p>
+
+<pre class="brush: js">{ 1 2 } 3
+
+// 會被 ASI 轉換成
+
+{ 1 2 ;} 3;</pre>
+
+<p>2.  當一個token輸入流到了結尾而解析器仍然無法將其解析為一個完整的程式,一個分號會被自動插入於其後。</p>
+
+<p>在這裡 <code>++</code> 並不會被當作作用於變數<code>b</code>的 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment">後綴運算元</a>,因為行終止字元出現在<code>b</code> 和 <code>++</code>之間。</p>
+
+<pre class="brush: js">a = b
+++c
+
+// 會被 ASI 轉換成
+
+a = b;
+++c;
+</pre>
+
+<p>3. 當一個運算式中出現 restricted productions 後面接著一個行終止元,一個分號會被自動插入於行終止元之前。以下這些陳述式有"不允許出現行終止元"規則:</p>
+
+<ul>
+ <li>後綴運算式 (<code>++</code> and <code>--</code>)</li>
+ <li><code>continue</code></li>
+ <li><code>break</code></li>
+ <li><code>return</code></li>
+ <li><code>yield</code>, <code>yield*</code></li>
+ <li><code>module</code></li>
+</ul>
+
+<pre class="brush: js">return
+a + b
+
+// 會被 ASI 轉換成
+
+return;
+a + b;
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2("ES1")}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-7', 'Lexical Conventions')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-ecmascript-language-lexical-grammar', 'Lexical Grammar')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Added: Binary and Octal Numeric literals, Unicode code point escapes, Templates</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-ecmascript-language-lexical-grammar', 'Lexical Grammar')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("javascript.grammar")}}</p>
+
+<p> </p>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li><a href="http://whereswalden.com/2013/08/12/micro-feature-from-es6-now-in-firefox-aurora-and-nightly-binary-and-octal-numbers/">Jeff Walden: Binary and octal numbers</a></li>
+ <li><a href="http://mathiasbynens.be/notes/javascript-escapes">Mathias Bynens: JavaScript character escape sequences</a></li>
+ <li>{{jsxref("Boolean")}}</li>
+ <li>{{jsxref("Number")}}</li>
+ <li>{{jsxref("RegExp")}}</li>
+ <li>{{jsxref("String")}}</li>
+</ul>
+</div>
diff --git a/files/zh-tw/web/javascript/reference/operators/arithmetic_operators/index.html b/files/zh-tw/web/javascript/reference/operators/arithmetic_operators/index.html
new file mode 100644
index 0000000000..a91f586c80
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/arithmetic_operators/index.html
@@ -0,0 +1,308 @@
+---
+title: 算術運算子
+slug: Web/JavaScript/Reference/Operators/Arithmetic_Operators
+translation_of: Web/JavaScript/Reference/Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><strong>算術運算子接受數值(資料型態為字串或變數都可)作為其運算子並回傳單個數值。 標準算術運算符號有加號(+),減號( - ),乘(*)和除(/)。</strong></p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-arithmetic.html")}}</div>
+
+
+
+<h2 id="Addition_()"><a id="加法" name="加法">Addition (+)</a></h2>
+
+<p>加法運算子生成數字(運算元)的總和或字串串接。</p>
+
+<h3 id="Syntax">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x + y
+</pre>
+
+<h3 id="Examples">Examples</h3>
+
+<pre class="brush: js">// Number + Number -&gt; addition
+1 + 2 // 3
+
+// Boolean + Number -&gt; addition
+true + 1 // 2
+
+// Boolean + Boolean -&gt; addition
+false + false // 0
+
+// Number + String -&gt; concatenation
+5 + 'foo' // "5foo"
+
+// String + Boolean -&gt; concatenation
+'foo' + false // "foofalse"
+
+// String + String -&gt; concatenation
+'foo' + 'bar' // "foobar"
+</pre>
+
+<h2 id="Subtraction_(-)"><a id="減法" name="減法">Subtraction (-)</a></h2>
+
+<p>減法運算子能算出兩個運算元間的差異。</p>
+
+<h3 id="Syntax_2">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x - y
+</pre>
+
+<h3 id="Examples_2">Examples</h3>
+
+<pre class="brush: js">5 - 3 // 2
+3 - 5 // -2
+'foo' - 3 // NaN</pre>
+
+<h2 id="Division_()"><a id="除法" name="除法">Division (/)</a></h2>
+
+<p>The division operator produces the quotient of its operands where the left operand is the dividend and the right operand is the divisor.</p>
+
+<h3 id="Syntax_3">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x / y
+</pre>
+
+<h3 id="Examples_3">Examples</h3>
+
+<pre class="brush: js">1 / 2 // returns 0.5 in JavaScript
+1 / 2 // returns 0 in Java
+// (neither number is explicitly a floating point number)
+
+1.0 / 2.0 // returns 0.5 in both JavaScript and Java
+
+2.0 / 0 // returns Infinity in JavaScript
+2.0 / 0.0 // returns Infinity too
+2.0 / -0.0 // returns -Infinity in JavaScript</pre>
+
+<h2 id="Multiplication_(*)"><a id="乘法" name="乘法">Multiplication (*)</a></h2>
+
+<p>The multiplication operator produces the product of the operands.</p>
+
+<h3 id="Syntax_4">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x * y
+</pre>
+
+<h3 id="Examples_4">Examples</h3>
+
+<pre class="brush: js">2 * 2 // 4
+-2 * 2 // -4
+Infinity * 0 // NaN
+Infinity * Infinity // Infinity
+'foo' * 2 // NaN
+</pre>
+
+<h2 id="Remainder_()"><a id="餘數運算" name="餘數運算">Remainder (%)</a></h2>
+
+<p>The remainder operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend.</p>
+
+<h3 id="Syntax_5">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> var1 % var2
+</pre>
+
+<h3 id="Examples_5">Examples</h3>
+
+<pre class="brush: js">12 % 5 // 2
+-1 % 2 // -1
+1 % -2 // 1
+NaN % 2 // NaN
+1 % 2 // 1
+2 % 3 // 2
+-4 % 2 // -0
+5.5 % 2 // 1.5
+</pre>
+
+<h2 id="Exponentiation_(**)"><a id="指數運算" name="指數運算">Exponentiation (**)</a></h2>
+
+<p>The exponentiation operator returns the result of raising first operand to the power second operand. that is, <code>var1</code><sup><code>var2</code></sup>, in the preceding statement, where <code>var1</code> and <code>var2</code> are variables. Exponentiation operator is right associative. <code>a ** b ** c</code> is equal to <code>a ** (b ** c)</code>.</p>
+
+<h3 id="Syntax_6">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> var1 ** var2
+</pre>
+
+<h3 id="Notes">Notes</h3>
+
+<p>In most languages like PHP and Python and others that have an exponentiation operator (**), the exponentiation operator is defined to have a higher precedence than unary operators such as unary + and unary -, but there are a few exceptions. For example, in Bash the ** operator is defined to have a lower precedence than unary operators. In JavaScript, it is impossible to write an ambiguous exponentiation expression, i.e. you cannot put a unary operator (<code>+/-/~/!/delete/void/typeof</code>) immediately before the base number.</p>
+
+<pre class="brush: js">-2 ** 2;
+// 4 in Bash, -4 in other languages.
+// This is invalid in JavaScript, as the operation is ambiguous.
+
+
+-(2 ** 2);
+// -4 in JavaScript and the author's intention is unambiguous.
+</pre>
+
+<h3 id="Examples_6">Examples</h3>
+
+<pre class="brush: js">2 ** 3 // 8
+3 ** 2 // 9
+3 ** 2.5 // 15.588457268119896
+10 ** -1 // 0.1
+NaN ** 2 // NaN
+
+2 ** 3 ** 2 // 512
+2 ** (3 ** 2) // 512
+(2 ** 3) ** 2 // 64
+</pre>
+
+<p>To invert the sign of the result of an exponentiation expression:</p>
+
+<pre class="brush: js">-(2 ** 2) // -4
+</pre>
+
+<p>To force the base of an exponentiation expression to be a negative number:</p>
+
+<pre class="brush: js">(-2) ** 2 // 4
+</pre>
+
+<div class="note">
+<p><strong>Note:</strong> JavaScript also has <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR">a bitwise operator ^ (logical XOR)</a>. <code>**</code> and <code>^</code> are different (for example : <code>2 ** 3 === 8</code> when <code>2 ^ 3 === 1</code>.)</p>
+</div>
+
+<h2 id="Increment_()"><a id="遞增運算" name="遞增運算">Increment (++)</a></h2>
+
+<p>The increment operator increments (adds one to) its operand and returns a value.</p>
+
+<ul>
+ <li>If used postfix, with operator after operand (for example, x++), then it returns the value before incrementing.</li>
+ <li>If used prefix with operator before operand (for example, ++x), then it returns the value after incrementing.</li>
+</ul>
+
+<h3 id="Syntax_7">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x++ or ++x
+</pre>
+
+<h3 id="Examples_7">Examples</h3>
+
+<pre class="brush: js">// Postfix
+var x = 3;
+y = x++; // y = 3, x = 4
+
+// Prefix
+var a = 2;
+b = ++a; // a = 3, b = 3
+</pre>
+
+<h2 id="Decrement_(--)"><a id="遞減運算" name="遞減運算">Decrement (--)</a></h2>
+
+<p>The decrement operator decrements (subtracts one from) its operand and returns a value.</p>
+
+<ul>
+ <li>If used postfix (for example, x--), then it returns the value before decrementing.</li>
+ <li>If used prefix (for example, --x), then it returns the value after decrementing.</li>
+</ul>
+
+<h3 id="Syntax_8">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> x-- or --x
+</pre>
+
+<h3 id="Examples_8">Examples</h3>
+
+<pre class="brush: js">// Postfix
+var x = 3;
+y = x--; // y = 3, x = 2
+
+// Prefix
+var a = 2;
+b = --a; // a = 1, b = 1
+</pre>
+
+<h2 id="Unary_negation_(-)"><a name="Unary_negation">Unary negation (-)</a></h2>
+
+<p>The unary negation operator precedes its operand and negates it.</p>
+
+<h3 id="Syntax_9">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> -x
+</pre>
+
+<h3 id="Examples_9">Examples</h3>
+
+<pre class="brush: js">var x = 3;
+y = -x; // y = -3, x = 3
+
+// Unary negation operator can convert non-numbers into a number
+var x = "4";
+y = -x; // y = -4
+</pre>
+
+<h2 id="Unary_plus_()"><a name="Unary_plus">Unary plus</a> (+)</h2>
+
+<p>The unary plus operator precedes its operand and evaluates to its operand but attempts to convert it into a number, if it isn't already. Although unary negation (-) also can convert non-numbers, unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number. It can convert string representations of integers and floats, as well as the non-string values <code>true</code>, <code>false</code>, and <code>null</code>. Integers in both decimal and hexadecimal ("0x"-prefixed) formats are supported. Negative numbers are supported (though not for hex). If it cannot parse a particular value, it will evaluate to {{jsxref("NaN")}}.</p>
+
+<h3 id="Syntax_10">Syntax</h3>
+
+<pre class="syntaxbox"><strong>Operator:</strong> +x
+</pre>
+
+<h3 id="Examples_10">Examples</h3>
+
+<pre class="brush: js">+3 // 3
++'3' // 3
++true // 1
++false // 0
++null // 0
++function(val){ return val } // NaN
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.3')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.6">Additive operators</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.5">Multiplicative operators</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.3">Postfix expressions</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.4">Unary operators</a>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-postfix-expressions')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-additive-operators">Additive operators</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-multiplicative-operators">Multiplicative operators</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-postfix-expressions">Postfix expressions</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-unary-operators">Unary operators</a>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2016', '#sec-postfix-expressions')}}</td>
+ <td>{{Spec2('ES2016')}}</td>
+ <td>Added <a href="https://github.com/rwaldron/exponentiation-operator">Exponentiation operator</a>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2017', '#sec-postfix-expressions')}}</td>
+ <td>{{Spec2('ES2017')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-additive-operators')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.operators.arithmetic")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators">Assignment operators</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/async_function/index.html b/files/zh-tw/web/javascript/reference/operators/async_function/index.html
new file mode 100644
index 0000000000..b0a761e890
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/async_function/index.html
@@ -0,0 +1,111 @@
+---
+title: async function expression
+slug: Web/JavaScript/Reference/Operators/async_function
+translation_of: Web/JavaScript/Reference/Operators/async_function
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>關鍵字 <strong><code>async function</code></strong> 可以用來定義陳述式中的 <code>async</code> 函式。</p>
+
+<p>你也可以使用 <a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Statements/async_function" title="The async function keyword can be used to define async functions inside expressions.">async function statement</a> 來定義一個非同步函式</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">async function [<em>name</em>]([<em>param1</em>[, <em>param2[</em>, ..., <em>paramN</em>]]]) {
+ <em>statements</em>
+}</pre>
+
+<p>As of ES2015, you can also use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow functions</a>.</p>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The function name. Can be omitted, in which case the function is <em>anonymous</em>. The name is only local to the function body.</dd>
+ <dt><code>paramN</code></dt>
+ <dd>The name of an argument to be passed to the function.</dd>
+ <dt><code>statements</code></dt>
+ <dd>The statements which comprise the body of the function.</dd>
+</dl>
+
+<h2 id="Description">Description</h2>
+
+<p>An <code>async function</code> expression is very similar to, and has almost the same syntax as, an {{jsxref('Statements/async_function', 'async function statement')}}. The main difference between an async <code>function</code> expression and an async <code>function</code> statement is the <em>function name,</em> which can be omitted in <code>async function</code> expressions to create <em>anonymous</em> functions. An <code>async function</code> expression can be used as an {{Glossary("IIFE")}} (Immediately Invoked Function Expression) which runs as soon as it is defined. See also the chapter about <a href="/en-US/docs/Web/JavaScript/Reference/Functions">functions</a> for more information.</p>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Simple_example">Simple example</h3>
+
+<pre class="brush: js">function resolveAfter2Seconds(x) {
+ return new Promise(resolve =&gt; {
+ setTimeout(() =&gt; {
+ resolve(x);
+ }, 2000);
+ });
+};
+
+
+var add = async function(x) { // async function expression assigned to a variable
+ var a = await resolveAfter2Seconds(20);
+ var b = await resolveAfter2Seconds(30);
+ return x + a + b;
+};
+
+add(10).then(v =&gt; {
+ console.log(v); // prints 60 after 4 seconds.
+});
+
+
+(async function(x) { // async function expression used as an IIFE
+ var p_a = resolveAfter2Seconds(20);
+ var p_b = resolveAfter2Seconds(30);
+ return x + await p_a + await p_b;
+})(10).then(v =&gt; {
+ console.log(v); // prints 60 after 2 seconds.
+});
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-definitions', 'async function')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2018', '#sec-async-function-definitions', 'async function')}}</td>
+ <td>{{Spec2('ES2018')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2017', '#sec-async-function-definitions', 'async function')}}</td>
+ <td>{{Spec2('ES2017')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.operators.async_function_expression")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Statements/async_function", "async function")}}</li>
+ <li>{{jsxref("AsyncFunction")}} object</li>
+ <li>{{jsxref("Operators/await", "await")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/await/index.html b/files/zh-tw/web/javascript/reference/operators/await/index.html
new file mode 100644
index 0000000000..a8bda40412
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/await/index.html
@@ -0,0 +1,152 @@
+---
+title: await
+slug: Web/JavaScript/Reference/Operators/await
+tags:
+ - Experimental
+ - JavaScript
+ - 運算子
+translation_of: Web/JavaScript/Reference/Operators/await
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<div>await運算子可被用來等待 {{jsxref("Promise")}},只能在 {{jsxref("Statements/async_function", "async function")}}內使用。</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">[<em>rv</em>] = await <em>expression</em>;</pre>
+
+<dl>
+ <dt><code>expression</code></dt>
+ <dd>等待解析的 {{jsxref("Promise")}} 物件或任何值。</dd>
+ <dt><font face="Consolas, Liberation Mono, Courier, monospace">rv = 回傳值</font></dt>
+ <dd>
+ <p>回傳 Promise 物件的 resolved 值,或當該值不是 Promise 物件時,回傳該值本身。</p>
+ </dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>此 await 表示法會暫停 async 函式執行,等待 Promise 物件的解析,並在 promise 物件的值被 resolve 時回復 async 函式的執行。await 接著回傳這個被 resolve 的值。如果回傳值不是一個 Promise 物件,則會被轉換為 resolved 狀態的 Promise 物件。</p>
+
+<p>如果 Promise 物件被 rejected,則 await 會丟出 rejected 的值。</p>
+
+<h2 id="範例">範例</h2>
+
+<p>若將 Promise 物件傳給 await 運算式,它會等待 Promise 解析並回傳 resolve 後的值。</p>
+
+<pre class="brush: js">function resolveAfter2Seconds(x) {
+ return new Promise(resolve =&gt; {
+ setTimeout(() =&gt; {
+ resolve(x);
+ }, 2000);
+ });
+}
+
+async function f1() {
+ var x = await resolveAfter2Seconds(10);
+ console.log(x); // 10
+}
+f1();
+</pre>
+
+<p>若傳給 await 的值並非一個 Promise 物件,它會將該值轉換為 resolved Promise,並等待之。</p>
+
+<pre class="brush: js">async function f2() {
+ var y = await 20;
+ console.log(y); // 20
+}
+f2();</pre>
+
+<p>若 Promise 被 reject,則丟出 reject 後的異常值。</p>
+
+<pre class="brush: js">async function f3() {
+ try {
+ var z = await Promise.reject(30);
+ } catch(e) {
+ console.log(e); // 30
+ }
+}
+f3();</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-definitions', 'async functions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>ES2017中初始定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Edge</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatChrome(55)}}</td>
+ <td>{{CompatGeckoDesktop("52.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOpera(42)}}</td>
+ <td>10.1</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>基本支援</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("52.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatOpera(42)}}</td>
+ <td>10.1</td>
+ <td>{{CompatChrome(55)}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Statements/async_function", "async function")}}</li>
+ <li>{{jsxref("Operators/async_function", "async function expression")}}</li>
+ <li>{{jsxref("AsyncFunction")}} object</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/bitwise_operators/index.html b/files/zh-tw/web/javascript/reference/operators/bitwise_operators/index.html
new file mode 100644
index 0000000000..ed5df1092b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/bitwise_operators/index.html
@@ -0,0 +1,554 @@
+---
+title: 位元運算子
+slug: Web/JavaScript/Reference/Operators/Bitwise_Operators
+translation_of: Web/JavaScript/Reference/Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><strong>位元運算子</strong>將運算元視為一段 32 位元長的 0 和 1 序列,而不是十進位、十六進位或八進位的 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Number" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number">Numbers</a></code>。 舉例來說,十進位的 9 可以用二進位表示為 1001。位元運算子對這樣的二進位表示法進行運算,然後回傳標準 JavaScript 數值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-bitwiseoperators.html")}}</div>
+
+
+
+<p>下表總結了 JavaScript 的位元運算子:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th>Operator</th>
+ <th>Usage</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#(位元_AND)">位元 AND</a></td>
+ <td><code>a &amp; b</code></td>
+ <td>當兩運算元的該位置皆為 <code>1</code> 時,回傳值的該位置為 <code>1</code>。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#(位元_OR)">位元 OR</a></td>
+ <td><code>a | b</code></td>
+ <td>當兩運算元的該位置有一者為 <code>1</code> 時,回傳值的該位置為 <code>1</code>。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#(位元_XOR)">位元 XOR</a></td>
+ <td><code>a ^ b</code></td>
+ <td>當兩運算元的該位置恰好一者為 <code>1</code> 時,回傳值的該位置為 <code>1</code>。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#(位元_NOT)">位元 NOT</a></td>
+ <td><code>~ a</code></td>
+ <td>將運算元的所有位元反轉。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#%3C%3C_(左移)">左移</a></td>
+ <td><code>a &lt;&lt; b</code></td>
+ <td>將 <code>a</code> 的二進位表示法左移 <code>b</code> (&lt; 32) 位元,右側補 <code>0</code>。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#%3E%3E_(保持符號右移)">保持符號右移</a></td>
+ <td><code>a &gt;&gt; b</code></td>
+ <td>將 <code>a</code> 的二進位表示法右移 <code>b</code> (&lt; 32) 位元,拋棄被移出的位元。</td>
+ </tr>
+ <tr>
+ <td><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#%3E%3E%3E_(填零右移)">填零右移</a></td>
+ <td><code>a &gt;&gt;&gt; b</code>  </td>
+ <td>將 <code>a</code> 的二進位表示法右移 <code>b</code> (&lt; 32) 位元,拋棄被移出的位元,並於右側補 <code>0</code>。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="帶號的_32位元整數">帶號的 32位元整數</h2>
+
+<p>所有位元運算子的運算元皆會被轉換成二<a href="https://en.wikipedia.org/wiki/Method_of_complements">補數系統</a>下的帶號32位元整數。二補數系統意味著一個整數的加法反元素(例如 5和 -5)是該整數的所有位元反轉(位元 NOT,也就是該數的一補數) 再加一。舉例來說,下面的序列代表著整數 314:</p>
+
+<pre class="brush: js">00000000000000000000000100111010
+</pre>
+
+<p>下面的序列代表 <code>~314</code>,也就是 <code>314</code> 的一補數:</p>
+
+<pre class="brush: js">11111111111111111111111011000101
+</pre>
+
+<p>接著,下面代表著 <code>-314</code>,也就是 <code>314</code> 的二補數:</p>
+
+<pre class="brush: js">11111111111111111111111011000110
+</pre>
+
+<p>二補數系統確保了正值時最左邊的位元為 0,反之則為 1。因此,最左邊的位元被稱作符號位。</p>
+
+<p>整數 <code>0</code> 全由位元 0組成。</p>
+
+<pre class="brush: js">0 (base 10) = 00000000000000000000000000000000 (base 2)
+</pre>
+
+<p>整數 <code>-1</code> 全由位元 1組成。</p>
+
+<pre class="brush: js">-1 (base 10) = 11111111111111111111111111111111 (base 2)
+</pre>
+
+<p>整數 <code>-2147483648</code> (十六進位: <code>-0x80000000</code>) 除了第一位為 1,其餘皆由位元 0組成。</p>
+
+<pre class="brush: js">-2147483648 (base 10) = 10000000000000000000000000000000 (base 2)
+</pre>
+
+<p>整數 <code>-2147483648</code> (十六進位: <code>-0x7fffffff</code>) 除了第一位為 0,其餘皆由位元 1組成。</p>
+
+<pre class="brush: js">2147483647 (base 10) = 01111111111111111111111111111111 (base 2)
+</pre>
+
+<p>整數 <code>-2147483648</code> 和 <code>2147483647</code> 分別為帶號32位元整數所能表示的最小值和最大值。</p>
+
+<h2 id="位元邏輯運算子">位元邏輯運算子</h2>
+
+<p>大致上,位元邏輯運算子的運作如下︰</p>
+
+<ul>
+ <li>運算元會被轉換成 32位元的整數,並被表達為一系列的位元 (0 和 1)。多於 32位元的數值在轉換中其超出第32位元的部分會被捨棄。下面的多於32位元整數在被轉換時:
+ <pre class="brush: js">Before: 11100110111110100000000000000110000000000001
+After: 10100000000000000110000000000001</pre>
+ </li>
+ <li>兩個運算元中的位元會根據其位置兩兩一組:第一個跟第一個、第二個跟第二個 ...</li>
+ <li>運算子會作用在每一組位元上,運算完成後再重新組合起來得到回傳值。</li>
+</ul>
+
+<h3 id="(位元_AND)"><a id="Bitwise_AND" name="Bitwise_AND">&amp; (位元 AND)</a></h3>
+
+<p>對每一組位元執行 AND 運算。<code>a</code> AND <code>b</code> 只在 <code>a</code> 和 <code>b</code> 同時為 <code>1</code> 時得到 1。AND運算的真值表如下:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">a</td>
+ <td class="header">b</td>
+ <td class="header">a AND b</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">. 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ 14 (base 10) = 00000000000000000000000000001110 (base 2)
+ --------------------------------
+14 &amp; 9 (base 10) = 00000000000000000000000000001000 (base 2) = 8 (base 10)
+</pre>
+
+<p>將任何數 <code>x</code> 和 <code>0</code> 做位元 AND 皆會得到 <code>0</code>。將任何數 <code>x</code> 和 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">-1</span></font> 做位元 AND 皆會得到 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">x</span></font>。</p>
+
+<h3 id="(位元_OR)"><a name="Bitwise_OR">| (位元 OR)</a></h3>
+
+<p>對每一組位元執行 OR 運算。<code>a</code> OR <code>b</code> 在 <code>a</code> 和 <code>b</code> 有一者為 <code>1</code> 時得到 1。OR運算的真值表如下:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">a</td>
+ <td class="header">b</td>
+ <td class="header">a OR b</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">. 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ 14 (base 10) = 00000000000000000000000000001110 (base 2)
+ --------------------------------
+14 | 9 (base 10) = 00000000000000000000000000001111 (base 2) = 15 (base 10)
+</pre>
+
+<p>將任何數 <code>x</code> 和 <code>0</code> 做位元 OR 皆會得到 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">x</span></font>。將任何數 <code>x</code> 和 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">-1</span></font> 做位元 OR 皆會得到 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">-1</span></font>。</p>
+
+<h3 id="(位元_XOR)"><a name="Bitwise_XOR">^ (位元 XOR)</a></h3>
+
+<p>對每一組位元執行 XOR 運算。<code>a</code> XOR <code>b</code> 只在 <code>a</code> 和 <code>b</code> 恰一者為 <code>1</code> 時得到 1。XOR運算的真值表如下:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">a</td>
+ <td class="header">b</td>
+ <td class="header">a XOR b</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>1</td>
+ <td>0</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">. 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ 14 (base 10) = 00000000000000000000000000001110 (base 2)
+ --------------------------------
+14 ^ 9 (base 10) = 00000000000000000000000000000111 (base 2) = 7 (base 10)
+</pre>
+
+<p>將任何數 <code>x</code> 和 <code>0</code> 做位元 AND 皆會得到 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">x</span></font>。將任何數 <code>x</code> 和 <font face="consolas, Liberation Mono, courier, monospace">-1</font> 做位元 AND 皆會得到 <code>~x</code>。</p>
+
+<h3 id="(位元_NOT)"><a name="Bitwise_NOT">~ (位元 NOT)</a></h3>
+
+<p>對每一個位元執行 NOT 運算。NOT <code>a</code> 會得到 <code>a</code> 的反轉值(也就是一補數)。NOT運算的真值表如下:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">a</td>
+ <td class="header">NOT a</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js"> 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ --------------------------------
+~9 (base 10) = 11111111111111111111111111110110 (base 2) = -10 (base 10)
+</pre>
+
+<p>將任何數 <code>x</code> 做位元 NOT 皆會得到 <code>-(x + 1)</code>。舉例來說,<code>~-5</code> 會得到 <code>4</code>。</p>
+
+<p>值得注意的是,因為使用 32位元表示法表示數值 <code>~-1</code> 和 <code>~4294967295</code> (2<sup>32</sup>-1) 皆會得到 <code>0</code>。</p>
+
+<h2 id="位元位移運算子">位元位移運算子</h2>
+
+<p>位移運算子需要兩個運算元:第一個是要被位移的值,第二個是位元位移量。位移的方向取決於使用的運算子。</p>
+
+<p>位移運算子將運算元轉換成 32位元的大端序整數並回傳一個與左運算元相同類別的值。右運算元應不大於32,如果超過的話,將只會使用後 5個位元。</p>
+
+<h3 id="&lt;&lt;_(左移)"><a name="Left_shift">&lt;&lt; (左移)</a></h3>
+
+<p>將第一個運算元向左位移指定的量。被移出的位元會被拋棄,並從右側補零。</p>
+
+<p>例如,<code>9 &lt;&lt; 2</code> 會得到 36:</p>
+
+<pre class="brush: js">. 9 (base 10): 00000000000000000000000000001001 (base 2)
+ --------------------------------
+9 &lt;&lt; 2 (base 10): 00000000000000000000000000100100 (base 2) = 36 (base 10)
+</pre>
+
+<p>將任意值 <code>x</code> 左移 <code>y</code> 位元會得到 <code>x * 2 ** y</code>。</p>
+
+<h3 id=">>_(保持符號右移)"><a name="Right_shift">&gt;&gt; (保持符號右移)</a></h3>
+
+<p>將第一個運算元向右位移指定的量。被移出的位元會被拋棄,並從左側補進和原本最左端相同的位元值。因為新的最左端位元和原本的最左端位元是一樣的,符號位(最左端位元)並不會改變。「保持符號」之名便是因此。</p>
+
+<p>例如,<code>9 &gt;&gt; 2</code> 會得到 2:</p>
+
+<pre class="brush: js">. 9 (base 10): 00000000000000000000000000001001 (base 2)
+ --------------------------------
+9 &gt;&gt; 2 (base 10): 00000000000000000000000000000010 (base 2) = 2 (base 10)
+</pre>
+
+<p>同樣地,<code>-9 &gt;&gt; 2</code> 會得到 <code>-3</code>,因為符號會保持不變。</p>
+
+<pre class="brush: js">. -9 (base 10): 11111111111111111111111111110111 (base 2)
+ --------------------------------
+-9 &gt;&gt; 2 (base 10): 11111111111111111111111111111101 (base 2) = -3 (base 10)
+</pre>
+
+<h3 id=">>>_(填零右移)"><a name="Unsigned_right_shift">&gt;&gt;&gt; (填零右移)</a></h3>
+
+<p>將第一個運算元向右位移指定的量。被移出的位元會被拋棄,並從左側補零。因為符號位變成 0,所以結果永遠都是正值。</p>
+
+<p>對非負的數來說,填零右移會得到和保持符號右移一樣的結果。例如,<code>9 &gt;&gt;&gt; 2</code> 和 <code>9 &gt;&gt; 2</code> 一樣,皆會得到 2:</p>
+
+<pre class="brush: js">. 9 (base 10): 00000000000000000000000000001001 (base 2)
+ --------------------------------
+9 &gt;&gt;&gt; 2 (base 10): 00000000000000000000000000000010 (base 2) = 2 (base 10)
+</pre>
+
+<p>然而對負值來說並不是這麼一回事。例如,<code>-9 &gt;&gt;&gt; 2</code> 會得到 1073741821,跟 <code>-9 &gt;&gt; 2</code> (得到 <code>-3</code>)的結果是不一樣的:</p>
+
+<pre class="brush: js">. -9 (base 10): 11111111111111111111111111110111 (base 2)
+ --------------------------------
+-9 &gt;&gt;&gt; 2 (base 10): 00111111111111111111111111111101 (base 2) = 1073741821 (base 10)
+</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="旗標(flags)_和遮罩_(bitmasks)">旗標(flags) 和遮罩 (bitmasks)</h3>
+
+<p>位元運算子常被用於生成、修改、和讀取旗標序列,就像是二進制的變數一般。雖然也可以使用普通變數,但使用二進制的旗標序列大大的減少了所需空間 (32 倍)。</p>
+
+<p>假設有 4個旗標:</p>
+
+<ul>
+ <li>旗標 A:我們有螞蟻問題</li>
+ <li>旗標 B:我們擁有一隻蝙蝠</li>
+ <li>旗標 C:我們擁有一隻貓</li>
+ <li>旗標 D:我們擁有一隻鴨子</li>
+</ul>
+
+<p>這些旗標倍表達成一個位元序列:DCBA。當一個旗標被立起 (set)時,其值為1。當一個旗標被放下 (clear),其值為0。假設有一變數 <code>flags</code> 的二進位值為 0101:</p>
+
+<pre class="brush: js">var flags = 5; // 二進位 0101
+</pre>
+
+<p>這個值表示:</p>
+
+<ul>
+ <li>旗標 A為真 (我們有螞蟻問題);</li>
+ <li>旗標 B為假 (我們並未擁有一隻蝙蝠);</li>
+ <li>旗標 C為真 (我們擁有一隻貓);</li>
+ <li>旗標 D為假 (我們並未擁有一隻鴨子);</li>
+</ul>
+
+<p>因為位元運算子進行的是 32位元操作,0101 實際上是 00000000000000000000000000000101,但前導的 0可被忽略因為他們沒有實際上的意義。</p>
+
+<p>位元遮罩則為一個可以修改且(或)讀取旗標序列的位元序列。通常為每個單獨旗標為真的「初始」值:</p>
+
+<pre class="brush: js">var FLAG_A = 1; // 0001
+var FLAG_B = 2; // 0010
+var FLAG_C = 4; // 0100
+var FLAG_D = 8; // 1000
+</pre>
+
+<p>新的位元遮罩可以透過對初始遮罩進行位元運算獲得。例如,遮罩 1011 可以透過對 FLAG_A、FLAG_B、和 FLAG_D進行 OR運算獲得:</p>
+
+<pre class="brush: js">var mask = FLAG_A | FLAG_B | FLAG_D; // 0001 | 0010 | 1000 =&gt; 1011
+</pre>
+
+<p>Individual flag values can be extracted by ANDing them with a bitmask, where each bit with the value of one will "extract" the corresponding flag. The bitmask <em>masks</em> out the non-relevant flags by ANDing with zeroes (hence the term "bitmask"). For example, the bitmask 0100 can be used to see if flag C is set:</p>
+
+<pre class="brush: js">// if we own a cat
+if (flags &amp; FLAG_C) { // 0101 &amp; 0100 =&gt; 0100 =&gt; true
+ // do stuff
+}
+</pre>
+
+<p>A bitmask with multiple set flags acts like an "either/or". For example, the following two are equivalent:</p>
+
+<pre class="brush: js">// if we own a bat or we own a cat
+// (0101 &amp; 0010) || (0101 &amp; 0100) =&gt; 0000 || 0100 =&gt; true
+if ((flags &amp; FLAG_B) || (flags &amp; FLAG_C)) {
+ // do stuff
+}
+</pre>
+
+<pre class="brush: js">// if we own a bat or cat
+var mask = FLAG_B | FLAG_C; // 0010 | 0100 =&gt; 0110
+if (flags &amp; mask) { // 0101 &amp; 0110 =&gt; 0100 =&gt; true
+ // do stuff
+}
+</pre>
+
+<p>Flags can be set by ORing them with a bitmask, where each bit with the value one will set the corresponding flag, if that flag isn't already set. For example, the bitmask 1100 can be used to set flags C and D:</p>
+
+<pre class="brush: js">// yes, we own a cat and a duck
+var mask = FLAG_C | FLAG_D; // 0100 | 1000 =&gt; 1100
+flags |= mask; // 0101 | 1100 =&gt; 1101
+</pre>
+
+<p>Flags can be cleared by ANDing them with a bitmask, where each bit with the value zero will clear the corresponding flag, if it isn't already cleared. This bitmask can be created by NOTing primitive bitmasks. For example, the bitmask 1010 can be used to clear flags A and C:</p>
+
+<pre class="brush: js">// no, we don't have an ant problem or own a cat
+var mask = ~(FLAG_A | FLAG_C); // ~0101 =&gt; 1010
+flags &amp;= mask; // 1101 &amp; 1010 =&gt; 1000
+</pre>
+
+<p>The mask could also have been created with <code>~FLAG_A &amp; ~FLAG_C</code> (De Morgan's law):</p>
+
+<pre class="brush: js">// no, we don't have an ant problem, and we don't own a cat
+var mask = ~FLAG_A &amp; ~FLAG_C;
+flags &amp;= mask; // 1101 &amp; 1010 =&gt; 1000
+</pre>
+
+<p>Flags can be toggled by XORing them with a bitmask, where each bit with the value one will toggle the corresponding flag. For example, the bitmask 0110 can be used to toggle flags B and C:</p>
+
+<pre class="brush: js">// if we didn't have a bat, we have one now,
+// and if we did have one, bye-bye bat
+// same thing for cats
+var mask = FLAG_B | FLAG_C;
+flags = flags ^ mask; // 1100 ^ 0110 =&gt; 1010
+</pre>
+
+<p>Finally, the flags can all be flipped with the NOT operator:</p>
+
+<pre class="brush: js">// entering parallel universe...
+flags = ~flags; // ~1010 =&gt; 0101
+</pre>
+
+<h3 id="Conversion_snippets">Conversion snippets</h3>
+
+<p>Convert a binary <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String" title="/en-US/docs/JavaScript/Reference/Global_Objects/String">String</a></code> to a decimal <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number">Number</a></code>:</p>
+
+<pre class="brush: js">var sBinString = '1011';
+var nMyNumber = parseInt(sBinString, 2);
+alert(nMyNumber); // prints 11, i.e. 1011
+</pre>
+
+<p>Convert a decimal <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number">Number</a></code> to a binary <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String" title="/en-US/docs/JavaScript/Reference/Global_Objects/String">String</a></code>:</p>
+
+<pre class="brush: js">var nMyNumber = 11;
+var sBinString = nMyNumber.toString(2);
+alert(sBinString); // prints 1011, i.e. 11
+</pre>
+
+<h3 id="Automate_Mask_Creation">Automate Mask Creation</h3>
+
+<p>You can create multiple masks from a set of <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="/en-US/docs/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code> values, like this:</p>
+
+<pre class="brush: js">function createMask() {
+ var nMask = 0, nFlag = 0, nLen = arguments.length &gt; 32 ? 32 : arguments.length;
+ for (nFlag; nFlag &lt; nLen; nMask |= arguments[nFlag] &lt;&lt; nFlag++);
+ return nMask;
+}
+var mask1 = createMask(true, true, false, true); // 11, i.e.: 1011
+var mask2 = createMask(false, false, true); // 4, i.e.: 0100
+var mask3 = createMask(true); // 1, i.e.: 0001
+// etc.
+
+alert(mask1); // prints 11, i.e.: 1011
+</pre>
+
+<h3 id="Reverse_algorithm_an_array_of_booleans_from_a_mask">Reverse algorithm: an array of booleans from a mask</h3>
+
+<p>If you want to create an <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array">Array</a></code> of <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="/en-US/docs/JavaScript/Reference/Global_Objects/Boolean">Booleans</a></code> from a mask you can use this code:</p>
+
+<pre class="brush: js">function arrayFromMask(nMask) {
+ // nMask must be between -2147483648 and 2147483647
+ if (nMask &gt; 0x7fffffff || nMask &lt; -0x80000000) {
+ throw new TypeError('arrayFromMask - out of range');
+ }
+ for (var nShifted = nMask, aFromMask = []; nShifted;
+ aFromMask.push(Boolean(nShifted &amp; 1)), nShifted &gt;&gt;&gt;= 1);
+ return aFromMask;
+}
+
+var array1 = arrayFromMask(11);
+var array2 = arrayFromMask(4);
+var array3 = arrayFromMask(1);
+
+alert('[' + array1.join(', ') + ']');
+// prints "[true, true, false, true]", i.e.: 11, i.e.: 1011
+</pre>
+
+<p>You can test both algorithms at the same time…</p>
+
+<pre class="brush: js">var nTest = 19; // our custom mask
+var nResult = createMask.apply(this, arrayFromMask(nTest));
+
+alert(nResult); // 19
+</pre>
+
+<p>For the didactic purpose only (since there is the <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString">Number.toString(2)</a></code> method), we show how it is possible to modify the <code>arrayFromMask</code> algorithm in order to create a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String" title="/en-US/docs/JavaScript/Reference/Global_Objects/String">String</a></code> containing the binary representation of a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" title="/en-US/docs/JavaScript/Reference/Global_Objects/Number">Number</a></code>, rather than an <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array">Array</a></code> of <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="/en-US/docs/JavaScript/Reference/Global_Objects/Boolean">Booleans</a></code>:</p>
+
+<pre class="brush: js">function createBinaryString(nMask) {
+ // nMask must be between -2147483648 and 2147483647
+ for (var nFlag = 0, nShifted = nMask, sMask = ''; nFlag &lt; 32;
+ nFlag++, sMask += String(nShifted &gt;&gt;&gt; 31), nShifted &lt;&lt;= 1);
+ return sMask;
+}
+
+var string1 = createBinaryString(11);
+var string2 = createBinaryString(4);
+var string3 = createBinaryString(1);
+
+alert(string1);
+// prints 00000000000000000000000000001011, i.e. 11
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.7')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.8">Bitwise NOT operator</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.7">Bitwise shift operators</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.10">Binary bitwise operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-bitwise-shift-operators')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-bitwise-not-operator">Bitwise NOT operator</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-bitwise-shift-operators">Bitwise shift operators</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-binary-bitwise-operators">Binary bitwise operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-bitwise-shift-operators')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://tc39.github.io/ecma262/#sec-bitwise-not-operator">Bitwise NOT operator</a>, <a href="http://tc39.github.io/ecma262/#sec-bitwise-shift-operators">Bitwise shift operators</a>, <a href="http://tc39.github.io/ecma262/#sec-binary-bitwise-operators">Binary bitwise operators</a></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("javascript.operators.bitwise")}}</p>
+
+<h2 id="另見">另見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators">Logical operators</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html b/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html
new file mode 100644
index 0000000000..3324cb156b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/comma_operator/index.html
@@ -0,0 +1,145 @@
+---
+title: 逗號運算子
+slug: Web/JavaScript/Reference/Operators/Comma_Operator
+translation_of: Web/JavaScript/Reference/Operators/Comma_Operator
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>The<strong> comma operator</strong> evaluates each of its operands (from left to right) and returns the value of the last operand.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>expr1</em>, <em>expr2, expr3...</em></pre>
+
+<h2 id="參數">參數</h2>
+
+<dl>
+ <dt><code>expr1</code>, <code>expr2, expr3...</code></dt>
+ <dd>Any expressions.</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>You can use the comma operator when you want to include multiple expressions in a location that requires a single expression. The most common usage of this operator is to supply multiple parameters in a <code>for</code> loop.</p>
+
+<h2 id="範例">範例</h2>
+
+<p>If <code>a</code> is a 2-dimensional array with 10 elements on each side, the following code uses the comma operator to increment two variables at once.</p>
+
+<p>The following code prints the values of the diagonal elements in the array:</p>
+
+<pre class="brush:js;highlight:[1]">for (var i = 0, j = 9; i &lt;= 9; i++, j--)
+ console.log("a[" + i + "][" + j + "] = " + a[i][j]);</pre>
+
+<p>Note that the comma in assignments such as the <code>var</code> statement may appear not to have the normal effect of comma operators because they don't exist within an expression. In the following example, <code>a</code> is set to the value of <code>b = 3</code> (which is 3), but the <code>c = 4</code> expression still evaluates and its result returned to console (i.e., 4). This is due to <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">operator precedence and associativity</a>.</p>
+
+<pre class="brush: js">// Note that the following creates globals and is disallowed in strict mode.
+
+a = b = 3, c = 4; // Returns 4 in console
+console.log(a); // 3 (left-most)
+
+x = (y = 5, z = 6); // Returns 6 in console
+console.log(x); // 6 (right-most)
+</pre>
+
+<p>The comma operator is fully different from the comma within arrays, objects, and function arguments and parameters.</p>
+
+<h3 id="Processing_and_then_returning">Processing and then returning</h3>
+
+<p>Another example that one could make with comma operator is processing before returning. As stated, only the last element will be returned but all others are going to be evaluated as well. So, one could do:</p>
+
+<pre class="brush: js">function myFunc () {
+ var x = 0;
+
+ return (x += 1, x); // the same as return ++x;
+}</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-comma-operator', 'Comma operator')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-comma-operator', 'Comma operator')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.14', 'Comma operator')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-11.14', 'Comma operator')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>3.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/for">for loop</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/comparison_operators/index.html b/files/zh-tw/web/javascript/reference/operators/comparison_operators/index.html
new file mode 100644
index 0000000000..70345e158c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/comparison_operators/index.html
@@ -0,0 +1,283 @@
+---
+title: 比較運算子
+slug: Web/JavaScript/Reference/Operators/Comparison_Operators
+translation_of: Web/JavaScript/Reference/Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>JavaScript has both strict and type–converting comparisons. A strict comparison (e.g., <code>===</code>) is only true if the operands are of the same type and the contents match. The more commonly-used abstract comparison (e.g. <code>==</code>) converts the operands to the same type before making the comparison. For relational abstract comparisons (e.g., <code>&lt;=</code>), the operands are first converted to primitives, then to the same type, before comparison.</p>
+
+<p>Strings are compared based on standard lexicographical ordering, using Unicode values.</p>
+
+<p>Features of comparisons:</p>
+
+<ul>
+ <li>Two strings are strictly equal when they have the same sequence of characters, same length, and same characters in corresponding positions.</li>
+ <li>Two numbers are strictly equal when they are numerically equal (have the same number value). <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN" title="NaN">NaN</a> is not equal to anything, including NaN. Positive and negative zeros are equal to one another.</li>
+ <li>Two Boolean operands are strictly equal if both are <code>true</code> or both are <code>false</code>.</li>
+ <li>Two distinct objects are never equal for either strict or abstract comparisons.</li>
+ <li>An expression comparing Objects is only true if the operands reference the same Object.</li>
+ <li>Null and Undefined Types are strictly equal to themselves and abstractly equal to each other.</li>
+</ul>
+
+<h2 id="Equality_operators">Equality operators</h2>
+
+<h3 id="Equality_()"><a name="Equality">Equality (==)</a></h3>
+
+<p>The equality operator converts the operands if they are <strong>not of the same type</strong>, then applies strict comparison. If <strong>both operands are objects</strong>, then JavaScript compares internal references which are equal when operands refer to the same object in memory.</p>
+
+<h4 id="Syntax">Syntax</h4>
+
+<pre class="syntaxbox">x == y
+</pre>
+
+<h4 id="Examples">Examples</h4>
+
+<pre class="brush: js"> 1 == 1 // true
+ "1" == 1 // true
+ 1 == '1' // true
+ 0 == false // true
+ 0 == null // false
+var object1 = {"value":"key"}, object2={"value":"key"};
+object1 == object2 //false
+
+ 0 == undefined // false
+null == undefined // true
+</pre>
+
+<h3 id="Inequality_(!)"><a name="Inequality">Inequality (!=)</a></h3>
+
+<p>The inequality operator returns true if the operands are not equal. If the two operands are <strong>not of the same type</strong>, JavaScript attempts to convert the operands to an appropriate type for the comparison. If <strong>both operands are objects</strong>, then JavaScript compares internal references which are not equal when operands refer to different objects in memory.</p>
+
+<h4 id="Syntax_2">Syntax</h4>
+
+<pre class="syntaxbox">x != y</pre>
+
+<h4 id="Examples_2">Examples</h4>
+
+<pre class="brush: js">1 != 2 // true
+1 != "1" // false
+1 != '1' // false
+1 != true // false
+0 != false // false
+</pre>
+
+<h3 id="Identity_strict_equality_()"><a name="Identity">Identity / strict equality (===)</a></h3>
+
+<p>The identity operator returns true if the operands are strictly equal (see above) <strong>with no type conversion</strong>. </p>
+
+<h4 id="Syntax_3">Syntax</h4>
+
+<pre class="syntaxbox">x === y</pre>
+
+<h4 id="Examples_3">Examples</h4>
+
+<pre class="brush: js ">3 === 3 // true
+3 === '3' // false
+var object1 = {"value":"key"}, object2={"value":"key"};
+object1 === object2 //false</pre>
+
+<p> </p>
+
+<h3 id="Non-identity_strict_inequality_(!)"><a name="Nonidentity">Non-identity / strict inequality (!==)</a></h3>
+
+<p>The non-identity operator returns true if the operands <strong>are not equal and/or not of the same type</strong>.</p>
+
+<h4 id="Syntax_4">Syntax</h4>
+
+<pre class="syntaxbox">x !== y</pre>
+
+<h4 id="Examples_4">Examples</h4>
+
+<pre class="brush: js">3 !== '3' // true
+4 !== 3 // true
+</pre>
+
+<h2 id="Relational_operators">Relational operators</h2>
+
+<p>Each of these operators will call the <code>valueOf()</code> function on each operand before a comparison is made.</p>
+
+<h3 id="Greater_than_operator_(>)"><a name="Greater_than_operator">Greater than operator (&gt;)</a></h3>
+
+<p>The greater than operator returns true if the left operand is greater than the right operand.</p>
+
+<h4 id="Syntax_5">Syntax</h4>
+
+<pre class="syntaxbox">x &gt; y</pre>
+
+<h4 id="Examples_5">Examples</h4>
+
+<pre class="brush: js">4 &gt; 3 // true
+</pre>
+
+<h3 id="Greater_than_or_equal_operator_(>)"><a name="Greater_than_or_equal_operator">Greater than or equal operator (&gt;=)</a></h3>
+
+<p>The greater than or equal operator returns true if the left operand is greater than or equal to the right operand.</p>
+
+<h4 id="Syntax_6">Syntax</h4>
+
+<pre class="syntaxbox"> x &gt;= y</pre>
+
+<h4 id="Examples_6">Examples</h4>
+
+<pre class="brush: js">4 &gt;= 3 // true
+3 &gt;= 3 // true
+</pre>
+
+<h3 id="Less_than_operator_(&lt;)"><a name="Less_than_operator">Less than operator (&lt;)</a></h3>
+
+<p>The less than operator returns true if the left operand is less than the right operand.</p>
+
+<h4 id="Syntax_7">Syntax</h4>
+
+<pre class="syntaxbox"> x &lt; y</pre>
+
+<h4 id="Examples_7">Examples</h4>
+
+<pre class="brush: js">3 &lt; 4 // true
+</pre>
+
+<h3 id="Less_than_or_equal_operator_(&lt;)"><a id="Less_than_or_equal_operator" name="Less_than_or_equal_operator">Less than or equal operator (&lt;=)</a></h3>
+
+<p>The less than or equal operator returns true if the left operand is less than or equal to the right operand.</p>
+
+<h4 id="Syntax_8">Syntax</h4>
+
+<pre class="syntaxbox"> x &lt;= y</pre>
+
+<h4 id="Examples_8">Examples</h4>
+
+<pre class="brush: js">3 &lt;= 4 // true
+</pre>
+
+<h2 id="Using_the_Equality_Operators">Using the Equality Operators</h2>
+
+<p>The standard equality operators (<code>==</code> and <code>!=</code>) use the <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3">Abstract Equality Comparison Algorithm</a> to compare two operands. If the operands are of different types, it will attempt to convert them to the same type before making the comparison, e.g., in the expression <code>5 == '5'</code>, the string on the right is converted to {{jsxref("Number")}} before the comparison is made.</p>
+
+<p>The strict equality operators (<code>===</code> and <code>!==</code>) use the <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.6">Strict Equality Comparison Algorithm</a> and are intended for performing equality comparisons on operands of the same type. If the operands are of different types, the result is always <code>false</code> so <code>5 !== '5'</code>.</p>
+
+<p>Use strict equality operators if the operands must be of a specific type as well as value or if the exact type of the operands is important. Otherwise, use the standard equality operators, which allow you to compare the identity of two operands even if they are not of the same type.</p>
+
+<p>When type conversion is involved in the comparison (i.e., non–strict comparison), JavaScript converts the types {{jsxref("String")}}, {{jsxref("Number")}}, {{jsxref("Boolean")}}, or {{jsxref("Object")}} operands as follows:</p>
+
+<ul>
+ <li>When comparing a number and a string, the string is converted to a number value. JavaScript attempts to convert the string numeric literal to a <code>Number</code> type value. First, a mathematical value is derived from the string numeric literal. Next, this value is rounded to nearest <code>Number</code> type value.</li>
+ <li>If one of the operands is <code>Boolean</code>, the Boolean operand is converted to 1 if it is <code>true</code> and +0 if it is <code>false</code>.</li>
+ <li>If an object is compared with a number or string, JavaScript attempts to return the default value for the object. Operators attempt to convert the object to a primitive value, a <code>String</code> or <code>Number</code> value, using the <code>valueOf</code> and <code>toString</code> methods of the objects. If this attempt to convert the object fails, a runtime error is generated.</li>
+ <li>Note that an object is converted into a primitive if, and only if, its comparand is a primitive. If both operands are objects, they're compared as objects, and the equality test is true only if both refer the same object.</li>
+</ul>
+
+<div class="note"><strong>Note:</strong> String objects are Type Object, not String! String objects are rarely used, so the following results might be surprising:</div>
+
+<pre class="brush:js">// true as both operands are type String (i.e. string primitives):
+'foo' === 'foo'
+
+var a = new String('foo');
+var b = new String('foo');
+
+// false as a and b are type Object and reference different objects
+a == b
+
+// false as a and b are type Object and reference different objects
+a === b
+
+// true as a and 'foo' are of different type and, the Object (a)
+// is converted to String 'foo' before comparison
+a == 'foo'</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Adds <code>===</code> and <code>!==</code> operators. Implemented in JavaScript 1.3</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.8')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.8">Relational Operators</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9">Equality Operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-relational-operators')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-relational-operators">Relational Operators</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-equality-operators">Equality Operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-relational-operators')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://tc39.github.io/ecma262/#sec-relational-operators">Relational Operators</a>, <a href="http://tc39.github.io/ecma262/#sec-equality-operators">Equality Operators</a></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Object.is()")}}</li>
+ <li>{{jsxref("Math.sign()")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness">Equality comparisons and sameness</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/conditional_operator/index.html b/files/zh-tw/web/javascript/reference/operators/conditional_operator/index.html
new file mode 100644
index 0000000000..78fb9a4a55
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/conditional_operator/index.html
@@ -0,0 +1,101 @@
+---
+title: 條件運算子
+slug: Web/JavaScript/Reference/Operators/Conditional_Operator
+translation_of: Web/JavaScript/Reference/Operators/Conditional_Operator
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><span class="seoSummary"><strong>條件 (三元) 運算子</strong> 是 JavaScript 唯一用到三個運算元的運算子:在一個條件後面會跟著一個問號 (<code>?</code>),如果條件是 <a href="/en-US/docs/Glossary/truthy">truthy</a>,在冒號(<code>:</code>)前的表達式會被執行,如果條件是 <a href="/en-US/docs/Glossary/falsy">falsy</a>,在冒號後面的表達式會被執行,</span>這個運算子常常被用來當作 <a href="/en-US/docs/Web/JavaScript/Reference/Statements/if...else"><code>if</code></a> 的簡潔寫法.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-conditionaloperators.html")}}</div>
+
+<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate"><var>condition</var> ? <var>exprIfTrue</var> : <var>exprIfFalse</var></pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code><var>condition</var></code></dt>
+ <dd>值用來做為條件的表達式</dd>
+ <dt><code><var>exprIfTrue</var></code></dt>
+ <dd>如果 <code><var>condition</var></code> 的值是 <a href="/en-US/docs/Glossary/truthy">truthy</a> (等於或是可轉換為 <code>true</code>) , <code><var>exprIfTrue</var></code>  會被執行</dd>
+ <dt><code><var>exprIfFalse</var></code></dt>
+ <dd>如果 <code><var>condition</var></code> 的值是 <a href="/en-US/docs/Glossary/falsy">falsy</a> (等於或是可轉換為 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">false</span></font>) , <code><var>exprIfFalse</var></code>  會被執行</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>除了 <code>false</code>, 可能是 falsy 的表達式有 <code>null</code>, <code>NaN</code>, <code>0</code>, 空字串 (<code>""</code>) 和 <code>undefined</code>. 如果<code><var>condition</var></code> 是他們其中之一 , 那麼條件表達式的結果會是 <code>exprIfFalse</code> 的執行結果. </p>
+
+<p>一個簡單的範例:</p>
+
+<pre class="brush: js notranslate">var age = 26;
+var beverage = (age &gt;= 21) ? "Beer" : "Juice";
+console.log(beverage); // "Beer"
+</pre>
+
+<p>一個常用來處理 <code>null</code> 的用法 : </p>
+
+<pre class="brush: js notranslate">function greeting(person) {
+ var name = person ? person.name : "stranger";
+ return "Howdy, " + name;
+}
+
+console.log(greeting({name: 'Alice'})); // "Howdy, Alice"
+console.log(greeting(null)); // "Howdy, stranger"
+</pre>
+
+<h3 id="條件鏈">條件鏈</h3>
+
+<p>條件 (三元) 運算子是右相依性的 (right-associative), 代表他可以以下面的方式鏈結 , 類似於 <code>if … else if … else if … else</code> 的鏈結方法 :</p>
+
+<pre class="brush: js notranslate">function example(…) {
+ return condition1 ? value1
+ : condition2 ? value2
+ : condition3 ? value3
+ : value4;
+}
+
+// Equivalent to:
+
+function example(…) {
+ if (condition1) { return value1; }
+ else if (condition2) { return value2; }
+ else if (condition3) { return value3; }
+ else { return value4; }
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-conditional-operator', 'Conditional Operator')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div>
+
+<p>{{Compat("javascript.operators.conditional")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/if...else">if statement</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator">Nullish coalescing operator</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining">Optional chaining</a></li>
+ <li><a href="/en-US/docs/Learn/JavaScript/Building_blocks/conditionals">Making decisions in your code — conditionals</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators">Expressions and operators</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html
new file mode 100644
index 0000000000..0cae43e2b5
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/destructuring_assignment/index.html
@@ -0,0 +1,423 @@
+---
+title: 解構賦值
+slug: Web/JavaScript/Reference/Operators/Destructuring_assignment
+tags:
+ - Destructuring
+ - Destructuring_assignment
+ - ECMAScript 2015
+ - ES6
+ - JavaScript
+ - Language feature
+ - Operator
+ - 解構
+translation_of: Web/JavaScript/Reference/Operators/Destructuring_assignment
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><strong>解構賦值</strong> (Destructuring assignment) 語法是一種 JavaScript 運算式,可以把陣列或物件中的資料解開擷取成為獨立變數。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-destructuringassignment.html", "taller")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush:js">let a, b, rest;
+[a, b] = [10, 20];
+console.log(a); // 10
+console.log(b); // 20
+
+[a, b, ...rest] = [10, 20, 30, 40, 50];
+console.log(a); // 10
+console.log(b); // 20
+console.log(rest); // [30, 40, 50]
+
+({ a, b } = { a: 10, b: 20 });
+console.log(a); // 10
+console.log(b); // 20
+
+
+// Stage 4(finished) proposal
+({a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40});
+console.log(a); // 10
+console.log(b); // 20
+console.log(rest); // {c: 30, d: 40}
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>物件與陣列運算式提供了簡單的方式,建立特定的資料組。</p>
+
+<pre class="brush: js">const x = [1, 2, 3, 4, 5];</pre>
+
+<p>解構賦值使用類似語法;不過在指定敘述式的左側,要宣告從來源變數接收解開值之變數。</p>
+
+<pre class="brush: js">const x = [1, 2, 3, 4, 5];
+const [y, z] = x;
+console.log(y); // 1
+console.log(z); // 2
+</pre>
+
+<p>Perl 和 Python 也有類似的語法和功能。</p>
+
+<h2 id="陣列解構">陣列解構</h2>
+
+<h3 id="基本變數指定敘述">基本變數指定敘述</h3>
+
+<pre class="brush: js">const foo = ['one', 'two', 'three'];
+
+const [red, yellow, green] = foo;
+console.log(red); // "one"
+console.log(yellow); // "two"
+console.log(green); // "three"
+</pre>
+
+<h3 id="宣告指派分開敍述">宣告指派分開敍述</h3>
+
+<p>變數可以在宣告式後,再透過解構賦值。</p>
+
+<pre class="brush:js">let a, b;
+
+[a, b] = [1, 2];
+console.log(a); // 1
+console.log(b); // 2
+</pre>
+
+<h3 id="預設值">預設值</h3>
+
+<p>當解構來源陣列對應的元素是 undefined 時,變數可以被設定預設值。</p>
+
+<pre class="brush: js">let a, b;
+
+[a=5, b=7] = [1];
+console.log(a); // 1
+console.log(b); // 7
+</pre>
+
+<h3 id="變數交換">變數交換</h3>
+
+<p>兩個變數可以透過一個解構指派式交換。</p>
+
+<p>沒有解構指派式時,這需要一個暫存變數來達成(或者像某些低階語言的 <a class="external" href="https://en.wikipedia.org/wiki/XOR_swap_algorithm">XOR-swap trick</a>)。</p>
+
+<pre class="brush:js">let a = 1;
+let b = 3;
+
+[a, b] = [b, a];
+console.log(a); // 3
+console.log(b); // 1
+
+const arr = [1,2,3];
+[arr[2], arr[1]] = [arr[1], arr[2]];
+console.log(arr); // [1,3,2]
+
+</pre>
+
+<h3 id="解析自函式回傳的陣列">解析自函式回傳的陣列</h3>
+
+<p>一直以來函式都可以回傳陣列,而解構指派式可以讓回傳的值更加簡潔。</p>
+
+<p>在這個例子, <code>f()</code> 回傳 <code>[1, 2]</code> ,接著透過一個解構指派式解析。</p>
+
+<pre class="brush:js">function f() {
+ return [1, 2];
+}
+
+let a, b;
+[a, b] = f();
+console.log(a); // 1
+console.log(b); // 2
+</pre>
+
+<h3 id="忽略某些回傳值">忽略某些回傳值</h3>
+
+<p>你可以忽略某些回傳值:</p>
+
+<pre class="brush:js">function f() {
+ return [1, 2, 3];
+}
+
+const [a, , b] = f();
+console.log(a); // 1
+console.log(b); // 3
+</pre>
+
+<p>當然你也可以忽略全部回傳值:</p>
+
+<pre class="brush:js">[,,] = f();
+</pre>
+
+<h3 id="把矩陣剩餘部分解構到一個變數">把矩陣剩餘部分解構到一個變數</h3>
+
+<p>解構一個陣列時,你可以透過其餘元素(rest pattern)將來源剩下之元素指派到一個變數:</p>
+
+<pre class="brush: js">const [a, ...b] = [1, 2, 3];
+console.log(a); // 1
+console.log(b); // [2, 3]</pre>
+
+<p>要注意的是,當左邊函式裡使用其餘解構,同時使用結尾逗號,這樣會拋出例外 {{jsxref("SyntaxError")}} :</p>
+
+<pre class="brush: js example-bad">const [a, ...b,] = [1, 2, 3];
+
+// SyntaxError 語法錯誤: 其餘元素不可以跟隨結尾逗號
+// 需要把其餘運算子放在最後的元素
+</pre>
+
+<h3 id="從正則運算式的比對結果取值">從正則運算式的比對結果取值</h3>
+
+<p>當正則運算式的方法 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec">exec()</a></code> 比對到一個值,其回傳陣列中的第一個值是相符的完整字串,後績的則是比對到正則運算式每組括號內的部分。當你沒需要利用第一個完整比對結果時,解構指派式讓你更簡單的取出後績元素。</p>
+
+<pre class="brush:js">function parseProtocol(url) {
+ const parsedURL = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url);
+ if (!parsedURL) {
+ return false;
+ }
+ console.log(parsedURL); // ["https://developer.mozilla.org/en-US/Web/JavaScript", "https", "developer.mozilla.org", "en-US/Web/JavaScript"]
+
+ const [, protocol, fullhost, fullpath] = parsedURL;
+ return protocol;
+}
+
+console.log(parseProtocol('https://developer.mozilla.org/en-US/Web/JavaScript')); // "https"
+</pre>
+
+<h2 id="物件解構">物件解構</h2>
+
+<h3 id="基本指派式">基本指派式</h3>
+
+<pre class="brush: js">const o = {p: 42, q: true};
+const {p, q} = o;
+
+console.log(p); // 42
+console.log(q); // true
+</pre>
+
+<h3 id="無宣告指派">無宣告指派</h3>
+
+<p>變數可以在宣告式後,再透過解構進行指派。</p>
+
+<pre class="brush:js">let a, b;
+
+({a, b} = {a:1, b:2});</pre>
+
+<div class="note">
+<p><strong>注意</strong>:當針對物件進行解構,而該句式沒有進行宣告時,指派式外必須加上括號 <code>( ... )</code> 。</p>
+
+<p><code>{a, b} = {a: 1, b: 2}</code> 不是有效的獨立語法,因為左邊的 <code>{a, b}</code> 被視為程式碼區塊而非物件。</p>
+
+<p>然而,<code>({a, b} = {a: 1, b: 2})</code> 是有效的,如同 <code>const {a, b} = {a: 1, b: 2}</code></p>
+
+<p><code>( ... )</code> 表達式前句需要以分號結束,否則可能把上一句視為函式隨即執行。</p>
+</div>
+
+<h3 id="指派到新的變數名稱">指派到新的變數名稱</h3>
+
+<p>物件中的屬性可以解構並擷取到名稱跟該屬性不一樣的變數。</p>
+
+<pre class="brush: js">const o = {p: 42, q: true};
+const {p: foo, q: bar} = o;
+
+console.log(foo); // 42
+console.log(bar); // true</pre>
+
+<p>舉例來說, <code>const {p: foo} = o</code> 把物件 <code>o</code> 裡名為 <code>p</code> 的屬性解出並指派到一個名為 <code>foo</code> 的本地變數。</p>
+
+<h3 id="預設值_2">預設值</h3>
+
+<p>當解構物件中對應的值是 <code>undefined</code> 時,變數可以設定預設值。</p>
+
+<pre class="brush: js">const {a = 10, b = 5} = {a: 3};
+
+console.log(a); // 3
+console.log(b); // 5</pre>
+
+<h3 id="指定新的變數名稱及預設值">指定新的變數名稱及預設值</h3>
+
+<p>屬性 1) 可以從物件中被解開,且被指定一個不同名稱的變數及 2) 同時指定一個預設值,在解開的值為 <code>undefined</code> 時使用。</p>
+
+<pre class="brush: js">const {a:aa = 10, b:bb = 5} = {a: 3};
+
+console.log(aa); // 3
+console.log(bb); // 5
+</pre>
+
+<h3 id="從作為函式參數的物件中提出某屬性的值">從作為函式參數的物件中提出某屬性的值</h3>
+
+<pre class="brush:js">const user = {
+ id: 42,
+ displayName: 'jdoe',
+ fullName: {
+ firstName: 'John',
+ lastName: 'Doe'
+ }
+};
+
+function userId({id}) {
+ return id;
+}
+
+function whois({displayName, fullName: {firstName: name}}) {
+ return `${displayName} is ${name}`;
+}
+
+console.log(userId(user)); // 42
+console.log(whois(user)); // "jdoe is John"</pre>
+
+<p>這樣從 user 物件中提出了 <code>id</code>, <code>displayName</code> 和 <code>firstName</code> 並且印出。</p>
+
+<h3 id="設定函式參數的預設值">設定函式參數的預設值</h3>
+
+<pre class="brush: js">function drawChart({size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}) {
+ console.log(size, coords, radius);
+ // do some chart drawing
+}
+
+drawChart({
+ coords: {x: 18, y: 30},
+ radius: 30
+});</pre>
+
+<div class="note">
+<p>在上述函式 <strong><code>drawChart</code></strong> 中,左方之解構式被指派到一個空物件: <code>{size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}</code> 。你也可以略過填寫右方的指派式。不過,當你沒有使用右方指派式時,函式在呼叫時會找出最少一個參數。透過上述形式,你可以直接不使用參數的呼叫 <code><strong>drawChart()</strong></code> 。當你希望在呼叫這個函式時不傳送參數,這個設計會帶來方便。而另一個設計則能讓你確保函式必須傳上一個物件作為參數。</p>
+</div>
+
+<h3 id="巢狀物件或陣列的解構">巢狀物件或陣列的解構</h3>
+
+<pre class="brush:js">const metadata = {
+ title: 'Scratchpad',
+ translations: [
+ {
+ locale: 'de',
+ localization_tags: [],
+ last_edit: '2014-04-14T08:43:37',
+ url: '/de/docs/Tools/Scratchpad',
+ title: 'JavaScript-Umgebung'
+ }
+ ],
+ url: '/en-US/docs/Tools/Scratchpad'
+};
+
+let {
+ title: englishTitle, // rename
+ translations: [
+ {
+ title: localeTitle, // rename
+ },
+ ],
+} = metadata;
+
+console.log(englishTitle); // "Scratchpad"
+console.log(localeTitle); // "JavaScript-Umgebung"</pre>
+
+<h3 id="循環取出的解構">循環取出的解構</h3>
+
+<pre class="brush: js">const people = [
+ {
+ name: 'Mike Smith',
+ family: {
+ mother: 'Jane Smith',
+ father: 'Harry Smith',
+ sister: 'Samantha Smith'
+ },
+ age: 35
+ },
+ {
+ name: 'Tom Jones',
+ family: {
+ mother: 'Norah Jones',
+ father: 'Richard Jones',
+ brother: 'Howard Jones'
+ },
+ age: 25
+ }
+];
+
+for (const {name: n, family: {father: f}} of people) {
+ console.log('Name: ' + n + ', Father: ' + f);
+}
+
+// "Name: Mike Smith, Father: Harry Smith"
+// "Name: Tom Jones, Father: Richard Jones"
+</pre>
+
+<h3 id="以物件演算屬性名稱解構">以物件演算屬性名稱解構</h3>
+
+<p>物件演算屬性名稱(像是在 <a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names">object literals</a>)可以在解構指派式使用。</p>
+
+<pre class="brush: js">let key = 'z';
+let {[key]: foo} = {z: 'bar'};
+
+console.log(foo); // "bar"
+</pre>
+
+<h3 id="在物件解構時使用其餘變數">在物件解構時使用其餘變數</h3>
+
+<p><a class="external external-icon" href="https://github.com/tc39/proposal-object-rest-spread">ECMAScript 中的其餘/展開屬性</a>在 proposal (stage 4) 新增了在解構式內使用<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/rest_parameters">其餘 (rest)</a> 語法的定義。其餘屬性可以收集解構式中沒有指定的屬性值。</p>
+
+<pre class="brush: js">let {a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40}
+a; // 10
+b; // 20
+rest; // { c: 30, d: 40 }</pre>
+
+<h3 id="不符合_JavaScript_識別字的屬性名稱">不符合 JavaScript 識別字的屬性名稱</h3>
+
+<p>解構賦值可以透過另一個符合 JavaScript <a href="/zh-TW/docs/Glossary/Identifier">識別字</a>的變數名稱來解出不符合識別字的屬性。</p>
+
+<pre class="brush: js">const foo = { 'fizz-buzz': true };
+const { 'fizz-buzz': fizzBuzz } = foo;
+
+console.log(fizzBuzz); // "true"
+</pre>
+
+<h3 id="混合使用矩陣及物件解構">混合使用矩陣及物件解構</h3>
+
+<p>矩陣及物件解構可以混合進行。與例來說,你只需要使用下列 <code>props</code> 矩陣中第三個元素之物件中的 <code>name</code> 屬性,你可以如下面的例子進行解構:</p>
+
+<pre class="brush: js">const props = [
+ { id: 1, name: 'Fizz'},
+ { id: 2, name: 'Buzz'},
+ { id: 3, name: 'FizzBuzz'}
+];
+
+const [,, { name }] = props;
+
+console.log(name); // "FizzBuzz"
+</pre>
+
+<h3 id="物件解構時的原型鏈追溯">物件解構時的原型鏈追溯</h3>
+
+<p>在進行物件解構時,如果一個屬性不在其當下存取,將會透過原型鏈 (prototype chain) 來進行追溯。</p>
+
+<pre>let obj = {self: '123'};
+obj.__proto__.prot = '456';
+const {self, prot} = obj;
+// self "123"
+// prot "456"(Access to the prototype chain)</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-destructuring-assignment', 'Destructuring assignment')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.operators.destructuring")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Assignment_Operators">Assignment operators</a></li>
+ <li><a href="https://hacks.mozilla.org/2015/05/es6-in-depth-destructuring/">"ES6 in Depth: Destructuring" on hacks.mozilla.org</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/index.html b/files/zh-tw/web/javascript/reference/operators/index.html
new file mode 100644
index 0000000000..e6efa9a181
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/index.html
@@ -0,0 +1,301 @@
+---
+title: 運算式與運算子
+slug: Web/JavaScript/Reference/Operators
+tags:
+ - NeedsTranslation
+ - TopicStub
+ - 運算子
+translation_of: Web/JavaScript/Reference/Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>本章節記錄了所有 JavaScript 運算式、運算子以及關鍵字。</p>
+
+<h2 id="運算式與運算子分類">運算式與運算子分類</h2>
+
+<p>以字母排列的清單請參考左側的側邊欄。</p>
+
+<h3 id="主要運算式">主要運算式</h3>
+
+<p>在 JavaScript 中基本的關鍵字與一般的運算式。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/this", "this")}}</dt>
+ <dd><code>this</code> 關鍵字可以參考執行函數的所在位置。</dd>
+ <dt>{{jsxref("Operators/function", "function")}}</dt>
+ <dd><code>function</code> 關鍵字可以定義一個函數運算式。</dd>
+ <dt>{{jsxref("Operators/class", "class")}}</dt>
+ <dd><code>class</code> 關鍵字可以定義一個類別運算式。</dd>
+ <dt>{{jsxref("Operators/function*", "function*")}}</dt>
+ <dd><code>function*</code> 關鍵字可以定義一個 Generator 函數運算式</dd>
+ <dt>{{jsxref("Operators/yield", "yield")}}</dt>
+ <dd>暫停與繼續一個產生器 (Generator) 函數。</dd>
+ <dt>{{jsxref("Operators/yield*", "yield*")}}</dt>
+ <dd>轉交另一個產生器 (Generator) 函數或可迭代 (Iterable) 的物件。</dd>
+ <dt>{{experimental_inline}} {{jsxref("Operators/async_function", "async function*")}}</dt>
+ <dd><code>async</code> 函數可以定義一個非同步函數運算式。</dd>
+ <dt>{{experimental_inline}} {{jsxref("Operators/await", "await")}}</dt>
+ <dd>暫停與繼續一個非同步函數並等候承諾的結果/拒絕。</dd>
+ <dt>{{jsxref("Global_Objects/Array", "[]")}}</dt>
+ <dd>陣列初始化/書寫格式。</dd>
+ <dt>{{jsxref("Operators/Object_initializer", "{}")}}</dt>
+ <dd>物件初始化/書寫格式。</dd>
+ <dt>{{jsxref("Global_Objects/RegExp", "/ab+c/i")}}</dt>
+ <dd>正規表示法書寫格式。</dd>
+ <dt>{{jsxref("Operators/Grouping", "( )")}}</dt>
+ <dd>分組運算子。</dd>
+</dl>
+
+<h3 id="左手邊運算式">左手邊運算式</h3>
+
+<p>左側值為賦值的目標。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Property_accessors", "Property accessors", "", 1)}}</dt>
+ <dd>成員運算子可存取物件的屬性或方法<br>
+ (<code>object.property</code> and <code>object["property"]</code>)。</dd>
+ <dt>{{jsxref("Operators/new", "new")}}</dt>
+ <dd><code>new</code> 運算子可以建立一個建構子 (Constructor) 的實例。</dd>
+ <dt><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/new.target">new.target</a></dt>
+ <dd>在建構子中 <code>new.target</code> 可以參考被 {{jsxref("Operators/new", "new")}} 呼叫的建構子 (Constructor) 。</dd>
+ <dt>{{jsxref("Operators/super", "super")}}</dt>
+ <dd><code>super</code> 關鍵字可以呼叫父建構子 (Constructor) 。</dd>
+ <dt>{{jsxref("Operators/Spread_operator", "...obj")}}</dt>
+ <dd>The spread operator allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.</dd>
+</dl>
+
+<h3 id="遞增與遞減">遞增與遞減</h3>
+
+<p>字尾/字首遞增與字尾/字首遞減運算子。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "A++", "#Increment")}}</dt>
+ <dd>字尾遞增運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "A--", "#Decrement")}}</dt>
+ <dd>字尾遞減運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "++A", "#Increment")}}</dt>
+ <dd>字首遞增運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "--A", "#Decrement")}}</dt>
+ <dd>字首遞減運算子。</dd>
+</dl>
+
+<h3 id="一元運算子">一元運算子</h3>
+
+<p>一元運算是指只需要使用一個運算元的運算。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/delete", "delete")}}</dt>
+ <dd><code>delete</code> 運算子可刪除物件中的屬性。</dd>
+ <dt>{{jsxref("Operators/void", "void")}}</dt>
+ <dd><code>void</code> 運算子可放棄一個運算式的回傳值。</dd>
+ <dt>{{jsxref("Operators/typeof", "typeof")}}</dt>
+ <dd><code>typeof</code> 運算子可以判斷一個指定物件的型態。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "+", "#Unary_plus")}}</dt>
+ <dd>一元正運算子可以轉換其運算元成為數值 (Number) 型態。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "-", "#Unary_negation")}}</dt>
+ <dd>一元負運算子可以轉換其運算元成為數值 (Number) 型態並轉為負值。</dd>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "~", "#Bitwise_NOT")}}</dt>
+ <dd>元位 NOT 運算子。</dd>
+ <dt>{{jsxref("Operators/Logical_Operators", "!", "#Logical_NOT")}}</dt>
+ <dd>邏輯 NOT 運算子。</dd>
+</dl>
+
+<h3 id="算術運算子">算術運算子</h3>
+
+<p>算術運算子會要用到數值 (不論是字面值或者變數) 做為運算元,並且會回傳單一數值結果。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "+", "#Addition")}}</dt>
+ <dd>加法運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "-", "#Subtraction")}}</dt>
+ <dd>減法運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "/", "#Division")}}</dt>
+ <dd>除法運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "*", "#Multiplication")}}</dt>
+ <dd>乘法運算子。</dd>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "%", "#Remainder")}}</dt>
+ <dd>餘數運算子。</dd>
+</dl>
+
+<dl>
+ <dt>{{jsxref("Operators/Arithmetic_Operators", "**", "#Exponentiation")}}</dt>
+ <dd>指數運算子。</dd>
+</dl>
+
+<h3 id="關係運算子">關係運算子</h3>
+
+<p>比較運算子會比較其運算元並根據比較的結果是否成立回傳一個 <code>Boolean</code> 值的結果。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/in", "in")}}</dt>
+ <dd><code>in</code> 運算子會判斷一個物件是否有指定的屬性。</dd>
+ <dt>{{jsxref("Operators/instanceof", "instanceof")}}</dt>
+ <dd><code>instanceof</code> 運算子會判斷一個物件是否為另一個物件的實例。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "&lt;", "#Less_than_operator")}}</dt>
+ <dd>小於運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "&gt;", "#Greater_than_operator")}}</dt>
+ <dd>大於運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "&lt;=", "#Less_than_or_equal_operator")}}</dt>
+ <dd>小於等於運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "&gt;=", "#Greater_than_or_equal_operator")}}</dt>
+ <dd>大於等於運算子。</dd>
+</dl>
+
+<div class="note">
+<p><strong>Note: =&gt;</strong> is not an operator, but the notation for <a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">Arrow functions</a>.</p>
+</div>
+
+<h3 id="相等運算子">相等運算子</h3>
+
+<p>執行相對運算子後的結果為比較結果是否成立的 <code>Boolean</code> 值。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Comparison_Operators", "==", "#Equality")}}</dt>
+ <dd>相等運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "!=", "#Inequality")}}</dt>
+ <dd>不相等運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "===", "#Identity")}}</dt>
+ <dd>恆等運算子。</dd>
+ <dt>{{jsxref("Operators/Comparison_Operators", "!==", "#Nonidentity")}}</dt>
+ <dd>不恆等運算子。</dd>
+</dl>
+
+<h3 id="位元移位運算子">位元移位運算子</h3>
+
+<p>用來位移運算元所有位元的運算。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "&lt;&lt;", "#Left_shift")}}</dt>
+ <dd>左移位元運算子。</dd>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "&gt;&gt;", "#Right_shift")}}</dt>
+ <dd>右移位元運算子。</dd>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "&gt;&gt;&gt;", "#Unsigned_right_shift")}}</dt>
+ <dd>右移無號位元運算子。</dd>
+</dl>
+
+<h3 id="二元位元運算子">二元位元運算子</h3>
+
+<p>位元運算子將其運算元當做是 32 位元 (32 個零與一) 的數值處理並回傳標準 JavaScript 數值。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "&amp;", "#Bitwise_AND")}}</dt>
+ <dd>位元 AND。</dd>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "|", "#Bitwise_OR")}}</dt>
+ <dd>位元 OR。</dd>
+ <dt>{{jsxref("Operators/Bitwise_Operators", "^", "#Bitwise_XOR")}}</dt>
+ <dd>位元 XOR。</dd>
+</dl>
+
+<h3 id="二元邏輯運算子">二元邏輯運算子</h3>
+
+<p>邏輯運算子一般用在處理布林 (邏輯) 值,它們存在的地方會回傳一個布林 (Boolean) 值。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Logical_Operators", "&amp;&amp;", "#Logical_AND")}}</dt>
+ <dd>邏輯 AND。</dd>
+ <dt>{{jsxref("Operators/Logical_Operators", "||", "#Logical_OR")}}</dt>
+ <dd>邏輯 OR。</dd>
+</dl>
+
+<h3 id="條件_(三元)_運算子">條件 (三元) 運算子</h3>
+
+<dl>
+ <dt>{{jsxref("Operators/Conditional_Operator", "(condition ? ifTrue : ifFalse)")}}</dt>
+ <dd>
+ <p>條件運算子會根據條件的邏輯值判斷並回傳其中一個值。</p>
+ </dd>
+</dl>
+
+<h3 id="賦值運算子">賦值運算子</h3>
+
+<p>賦值運算子會根據其右側運算元的數值處理後賦值給其左側的運算元。</p>
+
+<dl>
+ <dt>{{jsxref("Operators/Assignment_Operators", "=", "#Assignment")}}</dt>
+ <dd>賦值運算子。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "*=", "#Multiplication_assignment")}}</dt>
+ <dd>乘法賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "/=", "#Division_assignment")}}</dt>
+ <dd>除法賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "%=", "#Remainder_assignment")}}</dt>
+ <dd>餘數賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "+=", "#Addition_assignment")}}</dt>
+ <dd>加法賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "-=", "#Subtraction_assignment")}}</dt>
+ <dd>減法賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "&lt;&lt;=", "#Left_shift_assignment")}}</dt>
+ <dd>左移賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "&gt;&gt;=", "#Right_shift_assignment")}}</dt>
+ <dd>右移賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "&gt;&gt;&gt;=", "#Unsigned_right_shift_assignment")}}</dt>
+ <dd>無號右移賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "&amp;=", "#Bitwise_AND_assignment")}}</dt>
+ <dd>位元 AND 賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "^=", "#Bitwise_XOR_assignment")}}</dt>
+ <dd>位元 XOR 賦值。</dd>
+ <dt>{{jsxref("Operators/Assignment_Operators", "|=", "#Bitwise_OR_assignment")}}</dt>
+ <dd>位元 OR 賦值。</dd>
+ <dt>{{jsxref("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}}<br>
+ {{jsxref("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}}</dt>
+ <dd>
+ <p>解構賦值讓您可使用如陣列或物件書寫格式來賦值給陣列或物件的屬性。</p>
+ </dd>
+</dl>
+
+<h3 id="逗號運算子">逗號運算子</h3>
+
+<dl>
+ <dt>{{jsxref("Operators/Comma_Operator", ",")}}</dt>
+ <dd>逗號運算子允許在一個敘述句中執行多個運算式並回傳最後一個運算式的結果。</dd>
+</dl>
+
+<h3 id="非標準功能">非標準功能</h3>
+
+<dl>
+ <dt>{{non-standard_inline}} {{jsxref("Operators/Legacy_generator_function", "Legacy generator function", "", 1)}}</dt>
+ <dd>The <code>function</code> keyword can be used to define a legacy generator function inside an expression. To make the function a legacy generator, the function body should contains at least one {{jsxref("Operators/yield", "yield")}} expression.</dd>
+ <dt>{{non-standard_inline}} {{jsxref("Operators/Expression_closures", "Expression closures", "", 1)}}</dt>
+ <dd>The expression closure syntax is a shorthand for writing simple function.</dd>
+ <dt>{{non-standard_inline}} {{jsxref("Operators/Array_comprehensions", "[for (x of y) x]")}}</dt>
+ <dd>Array comprehensions.</dd>
+ <dt>{{non-standard_inline}} {{jsxref("Operators/Generator_comprehensions", "(for (x of y) y)")}}</dt>
+ <dd>Generator comprehensions.</dd>
+</dl>
+
+<h2 id="技術規格">技術規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">技術規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-11', 'Expressions')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11', 'Expressions')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-ecmascript-language-expressions', 'ECMAScript Language: Expressions')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>New: Spread operator, destructuring assignment, <code>super</code> keyword.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-ecmascript-language-expressions', 'ECMAScript Language: Expressions')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="相關文獻">相關文獻</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">Operator precedence</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/logical_operators/index.html b/files/zh-tw/web/javascript/reference/operators/logical_operators/index.html
new file mode 100644
index 0000000000..9a7138244c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/logical_operators/index.html
@@ -0,0 +1,243 @@
+---
+title: Logical operators
+slug: Web/JavaScript/Reference/Operators/Logical_Operators
+translation_of: Web/JavaScript/Reference/Operators
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>邏輯運算子通常會搭配 {{jsxref("Boolean")}} (logical) 值。若是,則回傳布林值。然而, <code>&amp;&amp;</code> 和 <code>||</code>  運算子通常回傳其中一運算元的值, 因此若這些運算子搭配非布林值使用,他們會回傳非布林值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-logicaloperator.html")}}</div>
+
+
+
+<h2 id="說明">說明</h2>
+
+<p>邏輯運算子的使用方式如下(<code><em>expr</em></code> 可能會是 <a href="/en-US/docs/Glossary/Data_structure">type</a>,不只是布林值):</p>
+
+<table class="fullwidth-table">
+ <tbody>
+ <tr>
+ <th>Operator</th>
+ <th>Syntax</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>邏輯 AND (<code>&amp;&amp;</code>)</td>
+ <td><code><em>expr1</em> &amp;&amp; <em>expr2</em></code></td>
+ <td>若 <code>expr<strong>1</strong></code> 可被轉換成 <code>true</code>, 回傳 <code>expr<strong>2</strong></code>; 否則 回傳 <code>expr<strong>1</strong></code>.</td>
+ </tr>
+ <tr>
+ <td>邏輯 OR (<code>||</code>)</td>
+ <td><code><em>expr1</em> || <em>expr2</em></code></td>
+ <td>若 <code>expr<strong>1</strong></code> 可被轉換成 <code>true</code>, 回傳 <code>expr<strong>1</strong></code>; 否則 回傳 <code>expr<strong>2</strong></code>.</td>
+ </tr>
+ <tr>
+ <td>邏輯 NOT (<code>!</code>)</td>
+ <td><code>!<em>expr</em></code></td>
+ <td>回傳 <code>false</code> 若它的單一運算元可被轉換成 <code>true</code>; 否則回傳 <code>true</code>.</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>If a value can be converted to <code>true</code>, the value is so-called {{Glossary("truthy")}}. If a value can be converted to <code>false</code>, the value is so-called {{Glossary("falsy")}}.</p>
+
+<p>Examples of expressions that can be converted to false are:</p>
+
+<ul>
+ <li><code>null</code>;</li>
+ <li><code>NaN</code>;</li>
+ <li><code>0</code>;</li>
+ <li>empty string (<code>""</code> or <code>''</code> or <code>``</code>);</li>
+ <li><code>undefined</code>.</li>
+</ul>
+
+<p>Even though the <code>&amp;&amp;</code> and <code>||</code> operators can be used with operands that are not Boolean values, they can still be considered boolean operators since their return values can always be converted to <a href="/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean primitives</a>. To explicitly convert their return value (or any expression in general) to the corresponding boolean value, use a double <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT">NOT operator</a> or the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> constructor.</p>
+
+<h3 id="Short-circuit_evaluation">Short-circuit evaluation</h3>
+
+<p>As logical expressions are evaluated left to right, they are tested for possible "short-circuit" evaluation using the following rules:</p>
+
+<ul>
+ <li><code>(some falsy expression) &amp;&amp; <em>expr</em></code> is short-circuit evaluated to the falsy expression;</li>
+ <li><code>(some truthy expression) || <em>expr</em></code> is short-circuit evaluated to the truthy expression.</li>
+</ul>
+
+<p>Short circuit means that the <em>expr</em> parts above are <strong>not evaluated</strong>, hence any side effects of doing so do not take effect (e.g., if <em>expr</em> is a function call, the calling never takes place). This happens because the value of the operator is already determined after the evaluation of the first operand. See example:</p>
+
+<pre class="brush: js">function A(){ console.log('called A'); return false; }
+function B(){ console.log('called B'); return true; }
+
+console.log( A() &amp;&amp; B() );
+// logs "called A" due to the function call,
+// then logs false (which is the resulting value of the operator)
+
+console.log( B() || A() );
+// logs "called B" due to the function call,
+// then logs true (which is the resulting value of the operator)
+</pre>
+
+<h3 id="Operator_precedence">Operator precedence</h3>
+
+<p>The following expressions might seem equivalent, but they are not, because the <code>&amp;&amp;</code> operator is executed before the <code>||</code> operator (see <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">operator precedence</a>).</p>
+
+<pre class="brush: js">true || false &amp;&amp; false // returns true, because &amp;&amp; is executed first
+(true || false) &amp;&amp; false // returns false, because operator precedence cannot apply</pre>
+
+<h3 id="Logical_AND_()"><a name="Logical_AND">Logical AND (<code>&amp;&amp;</code>)</a></h3>
+
+<p>The following code shows examples of the <code>&amp;&amp;</code> (logical AND) operator.</p>
+
+<pre class="brush: js">a1 = true &amp;&amp; true // t &amp;&amp; t returns true
+a2 = true &amp;&amp; false // t &amp;&amp; f returns false
+a3 = false &amp;&amp; true // f &amp;&amp; t returns false
+a4 = false &amp;&amp; (3 == 4) // f &amp;&amp; f returns false
+a5 = 'Cat' &amp;&amp; 'Dog' // t &amp;&amp; t returns "Dog"
+a6 = false &amp;&amp; 'Cat' // f &amp;&amp; t returns false
+a7 = 'Cat' &amp;&amp; false // t &amp;&amp; f returns false
+a8 = '' &amp;&amp; false // f &amp;&amp; f returns ""
+a9 = false &amp;&amp; '' // f &amp;&amp; f returns false
+</pre>
+
+<h3 id="Logical_OR_()"><a name="Logical_OR">Logical OR (<code>||</code>)</a></h3>
+
+<p>The following code shows examples of the <code>||</code> (logical OR) operator.</p>
+
+<pre class="brush: js">o1 = true || true // t || t returns true
+o2 = false || true // f || t returns true
+o3 = true || false // t || f returns true
+o4 = false || (3 == 4) // f || f returns false
+o5 = 'Cat' || 'Dog' // t || t returns "Cat"
+o6 = false || 'Cat' // f || t returns "Cat"
+o7 = 'Cat' || false // t || f returns "Cat"
+o8 = '' || false // f || f returns false
+o9 = false || '' // f || f returns ""
+o10 = false || varObject // f || object returns varObject
+</pre>
+
+<h3 id="Logical_NOT_(!)"><a name="Logical_NOT">Logical NOT (<code>!</code>)</a></h3>
+
+<p>The following code shows examples of the <code>!</code> (logical NOT) operator.</p>
+
+<pre class="brush: js">n1 = !true // !t returns false
+n2 = !false // !f returns true
+n3 = !'' // !f returns true
+n4 = !'Cat' // !t returns false
+</pre>
+
+<h4 id="Double_NOT_(!!)">Double NOT (<code>!!</code>)</h4>
+
+<p>It is possible to use a couple of NOT operators in series to explicitly force the conversion of any value to the corresponding <a href="/en-US/docs/Web/JavaScript/Data_structures#Boolean_type">boolean primitive</a>. The conversion is based on the "truthyness" or "falsyness" of the value (see {{Glossary("truthy")}} and {{Glossary("falsy")}}).</p>
+
+<p>The same conversion can be done through the {{jsxref("Boolean")}} function.</p>
+
+<pre class="brush: js">n1 = !!true // !!truthy returns true
+n2 = !!{} // !!truthy returns true: <strong>any</strong> object is truthy...
+n3 = !!(new Boolean(false)) // ...even Boolean objects with a false <em>.valueOf()</em>!
+n4 = !!false // !!falsy returns false
+n5 = !!"" // !!falsy returns false
+n6 = !!Boolean(false) // !!falsy returns false
+</pre>
+
+<h3 id="Conversion_rules_for_booleans">Conversion rules for booleans</h3>
+
+<h4 id="Converting_AND_to_OR">Converting AND to OR</h4>
+
+<p>The following operation involving <strong>booleans</strong>:</p>
+
+<pre class="brush: js">bCondition1 &amp;&amp; bCondition2</pre>
+
+<p>is always equal to:</p>
+
+<pre class="brush: js">!(!bCondition1 || !bCondition2)</pre>
+
+<h4 id="Converting_OR_to_AND">Converting OR to AND</h4>
+
+<p>The following operation involving <strong>booleans</strong>:</p>
+
+<pre class="brush: js">bCondition1 || bCondition2</pre>
+
+<p>is always equal to:</p>
+
+<pre class="brush: js">!(!bCondition1 &amp;&amp; !bCondition2)</pre>
+
+<h4 id="Converting_between_NOTs">Converting between NOTs</h4>
+
+<p>The following operation involving <strong>booleans</strong>:</p>
+
+<pre class="brush: js">!!bCondition</pre>
+
+<p>is always equal to:</p>
+
+<pre class="brush: js">bCondition</pre>
+
+<h3 id="Removing_nested_parentheses">Removing nested parentheses</h3>
+
+<p>As logical expressions are evaluated left to right, it is always possible to remove parentheses from a complex expression following some rules.</p>
+
+<h4 id="Removing_nested_AND">Removing nested AND</h4>
+
+<p>The following composite operation involving <strong>booleans</strong>:</p>
+
+<pre class="brush: js">bCondition1 || (bCondition2 &amp;&amp; bCondition3)</pre>
+
+<p>is always equal to:</p>
+
+<pre class="brush: js">bCondition1 || bCondition2 &amp;&amp; bCondition3</pre>
+
+<h4 id="Removing_nested_OR">Removing nested OR</h4>
+
+<p>The following composite operation involving <strong>booleans</strong>:</p>
+
+<pre class="brush: js">bCondition1 &amp;&amp; (bCondition2 || bCondition3)</pre>
+
+<p>is always equal to:</p>
+
+<pre class="brush: js">!(!bCondition1 || !bCondition2 &amp;&amp; !bCondition3)</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.11')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.9">Logical NOT Operator</a>, <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.11">Binary Logical Operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-binary-logical-operators')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-logical-not-operator">Logical NOT Operator</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-binary-logical-operators">Binary Logical Operators</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-binary-logical-operators')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Defined in several sections of the specification: <a href="http://tc39.github.io/ecma262/#sec-logical-not-operator">Logical NOT Operator</a>, <a href="http://tc39.github.io/ecma262/#sec-binary-logical-operators">Binary Logical Operators</a></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.operators.logical")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators">Bitwise operators</a></li>
+ <li>{{jsxref("Boolean")}}</li>
+ <li><a href="/en-US/docs/Glossary/Truthy">Truthy</a></li>
+ <li><a href="/en-US/docs/Glossary/Falsy">Falsy</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html b/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html
new file mode 100644
index 0000000000..c8e4308f32
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/object_initializer/index.html
@@ -0,0 +1,431 @@
+---
+title: Object initializer
+slug: Web/JavaScript/Reference/Operators/Object_initializer
+translation_of: Web/JavaScript/Reference/Operators/Object_initializer
+---
+<div>{{JsSidebar("Operators")}}</div>
+
+<p>Objects can be initialized using <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object"><code>new Object()</code></a>,<code> <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create">Object.create()</a></code>, or using the <em>literal</em> notation (<em>initializer</em> notation). An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces (<code>{}</code>).</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">var o = {};
+var o = {a: 'foo', b: 42, c: {}};
+
+var a = 'foo', b = 42, c = {};
+var o = {a: a, b: b, c: c};
+
+var o = {
+ <var>property: function </var>([<var>parameters</var>]) {},
+ get <var>property</var>() {},
+ set <var>property</var>(<var>value</var>) {}
+};
+</pre>
+
+<h3 id="New_notations_in_ECMAScript_2015">New notations in ECMAScript 2015</h3>
+
+<p>Please see the compatibility table for support for these notations. In non-supporting environments, these notations will lead to syntax errors.</p>
+
+<pre class="brush: js">// Shorthand property names (ES2015)
+var a = 'foo', b = 42, c = {};
+var o = {a, b, c};
+
+// Shorthand method names (ES2015)
+var o = {
+ <var>property</var>([<var>parameters</var>]) {}
+};
+
+// Computed property names (ES2015)
+var prop = 'foo';
+var o = {
+ [prop]: 'hey',
+ ['b' + 'ar']: 'there'
+};</pre>
+
+<h2 id="說明">說明</h2>
+
+<p>An object initializer is an expression that describes the initialization of an {{jsxref("Object")}}. Objects consist of <em>properties</em>, which are used to describe an object. Values of object properties can either contain {{Glossary("primitive")}} data types or other objects.</p>
+
+<h3 id="建立物件">建立物件</h3>
+
+<p>An empty object with no properties can be created like this:</p>
+
+<pre class="brush: js">var object = {};</pre>
+
+<p>However, the advantage of the <em>literal</em> or <em>initializer</em> notation is, that you are able to quickly create objects with properties inside the curly braces. You simply notate a list of <code>key: value</code> pairs delimited by comma. The following code creates an object with three properties and the keys are <code>"foo"</code>, <code>"age"</code> and <code>"baz"</code>. The values of these keys are a string <code>"bar"</code>, a number <code>42</code> and the third property has another object as its value.</p>
+
+<pre class="brush: js">var object = {
+ foo: 'bar',
+ age: 42,
+ baz: {myProp: 12}
+}</pre>
+
+<h3 id="存取屬性">存取屬性</h3>
+
+<p>Once you have created an object, you might want to read or change them. Object properties can be accessed by using the dot notation or the bracket notation. See <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors">property accessors</a> for detailed information.</p>
+
+<pre class="brush: js">object.foo; // "bar"
+object['age']; // 42
+
+object.foo = 'baz';
+</pre>
+
+<h3 id="屬性定義">屬性定義</h3>
+
+<p>We have already learned how to notate properties using the initializer syntax. Oftentimes, there are variables in your code that you would like to put into an object. You will see code like this:</p>
+
+<pre class="brush: js">var a = 'foo',
+ b = 42,
+ c = {};
+
+var o = {
+ a: a,
+ b: b,
+ c: c
+};</pre>
+
+<p>With ECMAScript 2015, there is a shorter notation available to achieve the same:</p>
+
+<pre class="brush: js">var a = 'foo',
+ b = 42,
+ c = {};
+
+// Shorthand property names (ES2015)
+var o = {a, b, c};
+
+// In other words,
+console.log((o.a === {a}.a)); // true
+</pre>
+
+<h4 id="Duplicate_property_names">Duplicate property names</h4>
+
+<p>When using the same name for your properties, the second property will overwrite the first.</p>
+
+<pre class="brush: js">var a = {x: 1, x: 2};
+console.log(a); // {x: 2}
+</pre>
+
+<p>In ECMAScript 5 strict mode code, duplicate property names were considered a {{jsxref("SyntaxError")}}.  With the introduction of computed property names making duplication possible at runtime, ECMAScript 2015 has removed this restriction.</p>
+
+<pre class="brush: js">function haveES2015DuplicatePropertySemantics() {
+ 'use strict';
+ try {
+ ({prop: 1, prop: 2});
+
+ // No error thrown, duplicate property names allowed in strict mode
+ return true;
+ } catch(e) {
+ // Error thrown, duplicates prohibited in strict mode
+ return false;
+ }
+}</pre>
+
+<h3 id="方法定義">方法定義</h3>
+
+<p>A property of an object can also refer to a <a href="/en-US/docs/Web/JavaScript/Reference/Functions">function</a> or a <a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">getter</a> or <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a> method.</p>
+
+<pre class="brush: js">var o = {
+ <var>property: function </var>([<var>parameters</var>]) {},
+ get <var>property</var>() {},
+ set <var>property</var>(<var>value</var>) {}
+};</pre>
+
+<p>In ECMAScript 2015, a shorthand notation is available, so that the keyword "function" is no longer necessary.</p>
+
+<pre class="brush: js">// Shorthand method names (ES2015)
+var o = {
+ <var>property</var>([<var>parameters</var>]) {},
+ *<var>generator</var>() {}
+};</pre>
+
+<p>In ECMAScript 2015 There is a way to concisely define properties whose values are generator functions:</p>
+
+<pre class="brush: js">var o = {
+ *<var>generator</var>() {
+ ...........
+ }
+};</pre>
+
+<p>Which is equivalent to this ES5-like notation (but note that ECMAScript 5 has no generators):</p>
+
+<pre class="brush: js">var o = {
+ generator<var>: function* </var>() {
+ ...........
+ }
+};</pre>
+
+<p>For more information and examples about methods, see <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">method definitions</a>.</p>
+
+<h3 id="Computed_property_names">Computed property names</h3>
+
+<p>Starting with ECMAScript 2015, the object initializer syntax also supports computed property names. That allows you to put an expression in brackets <code>[]</code>, that will be computed as the property name. This is symmetrical to the bracket notation of the <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors">property accessor</a> syntax, which you might have used to read and set properties already. Now you can use the same syntax in object literals, too:</p>
+
+<pre class="brush: js">// Computed property names (ES2015)
+var i = 0;
+var a = {
+ ['foo' + ++i]: i,
+ ['foo' + ++i]: i,
+ ['foo' + ++i]: i
+};
+
+console.log(a.foo1); // 1
+console.log(a.foo2); // 2
+console.log(a.foo3); // 3
+
+var param = 'size';
+var config = {
+ [param]: 12,
+ ['mobile' + param.charAt(0).toUpperCase() + param.slice(1)]: 4
+};
+
+console.log(config); // {size: 12, mobileSize: 4}</pre>
+
+<h3 id="Spread_properties">Spread properties</h3>
+
+<p>The <a href="https://github.com/tc39/proposal-object-rest-spread">Rest/Spread Properties for ECMAScript</a> proposal (stage 3) adds <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator">spread</a> properties to object literals. It copies own enumerable properties from a provided object onto a new object.</p>
+
+<p>Shallow-cloning (excluding prototype) or merging objects is now possible using a shorter syntax than {{jsxref("Object.assign()")}}.</p>
+
+<pre class="brush: js">var obj1 = { foo: 'bar', x: 42 };
+var obj2 = { foo: 'baz', y: 13 };
+
+var clonedObj = { ...obj1 };
+// Object { foo: "bar", x: 42 }
+
+var mergedObj = { ...obj1, ...obj2 };
+// Object { foo: "baz", x: 42, y: 13 }</pre>
+
+<p>Note that {{jsxref("Object.assign()")}} triggers <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setters</a> whereas the spread operator doesn't.</p>
+
+<h3 id="Prototype_mutation">Prototype mutation</h3>
+
+<p>A property definition of the form <code>__proto__: value</code> or <code>"__proto__": value</code> does not create a property with the name <code>__proto__</code>.  Instead, if the provided value is an object or <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/null"><code>null</code></a>, it changes the <code>[[Prototype]]</code> of the created object to that value.  (If the value is not an object or null, the object is not changed.)</p>
+
+<pre class="brush: js">var obj1 = {};
+assert(Object.getPrototypeOf(obj1) === Object.prototype);
+
+var obj2 = {__proto__: null};
+assert(Object.getPrototypeOf(obj2) === null);
+
+var protoObj = {};
+var obj3 = {'__proto__': protoObj};
+assert(Object.getPrototypeOf(obj3) === protoObj);
+
+var obj4 = {__proto__: 'not an object or null'};
+assert(Object.getPrototypeOf(obj4) === Object.prototype);
+assert(!obj4.hasOwnProperty('__proto__'));
+</pre>
+
+<p>Only a single prototype mutation is permitted in an object literal: multiple prototype mutations are a syntax error.</p>
+
+<p>Property definitions that do not use "colon" notation are not prototype mutations: they are property definitions that behave identically to similar definitions using any other name.</p>
+
+<pre class="brush: js">var __proto__ = 'variable';
+
+var obj1 = {__proto__};
+assert(Object.getPrototypeOf(obj1) === Object.prototype);
+assert(obj1.hasOwnProperty('__proto__'));
+assert(obj1.__proto__ === 'variable');
+
+var obj2 = {__proto__() { return 'hello'; }};
+assert(obj2.__proto__() === 'hello');
+
+var obj3 = {['__prot' + 'o__']: 17};
+assert(obj3.__proto__ === 17);
+</pre>
+
+<h2 id="Object_literal_notation_vs_JSON">Object literal notation vs JSON</h2>
+
+<p>Object literal notation與<strong>J</strong>ava<strong>S</strong>cript <strong>O</strong>bject <strong>N</strong>otation (<a href="/en-US/docs/Glossary/JSON">JSON</a>)是不一樣的東西. 儘管它們看起來很相似,但還是有以下的不同:</p>
+
+<ul>
+ <li>JSON只允許屬性透過<code>"property": value</code>格式定義. 屬性名稱必須使用雙引號包起來,且不能是速記。</li>
+ <li>JSON的數值僅能為string, numbers, arrays, <code>true</code>, <code>false</code>, <code>null</code>, 或另一個JSON物件.</li>
+ <li>A function value (see "Methods" above) can not be assigned to a value in JSON.</li>
+ <li>Objects like {{jsxref("Date")}} will be a string after {{jsxref("JSON.parse()")}}.</li>
+ <li>{{jsxref("JSON.parse()")}} will reject computed property names and an error will be thrown.</li>
+</ul>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.1.5', 'Object Initializer')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">getter</a> and <a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">setter</a> added.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-object-initializer', 'Object Initializer')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Shorthand method/property names and computed property names added.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object-initializer', 'Object Initializer')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><a href="https://github.com/tc39/proposal-object-rest-spread">Rest/Spread Properties for ECMAScript </a></td>
+ <td>Draft</td>
+ <td>Stage 3 draft.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(1.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("1.0")}}</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>Computed property names</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("34")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>7.1</td>
+ </tr>
+ <tr>
+ <td>Shorthand property names</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("33")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>9</td>
+ </tr>
+ <tr>
+ <td>Shorthand method names</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("34")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>9</td>
+ </tr>
+ <tr>
+ <td>Spread properties</td>
+ <td>{{CompatChrome(60)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoDesktop("55")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("1.0")}}</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>{{CompatChrome(1.0)}}</td>
+ </tr>
+ <tr>
+ <td>Computed property names</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("34")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>7.1</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td>Shorthand property names</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("33")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>9</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td>Shorthand method names</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("34")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>34</td>
+ <td>9</td>
+ <td>{{CompatChrome(42.0)}}</td>
+ </tr>
+ <tr>
+ <td>Spread properties</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("55")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors">Property accessors</a></li>
+ <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/get">get</a></code> / <code><a href="/en-US/docs/Web/JavaScript/Reference/Functions/set">set</a></code></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">Method definitions</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Lexical_grammar">Lexical grammar</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html b/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html
new file mode 100644
index 0000000000..0395059d09
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/operator_precedence/index.html
@@ -0,0 +1,316 @@
+---
+title: 運算子優先序
+slug: Web/JavaScript/Reference/Operators/Operator_Precedence
+tags:
+ - JavaScript
+ - Operator
+ - precedence
+translation_of: Web/JavaScript/Reference/Operators/Operator_Precedence
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>運算子優先序(Operator precedence)決定了運算子彼此之間被語法解析的方式,優先序較高的運算子會成為優先序較低運算子的運算元(operands)。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-operatorprecedence.html")}}</div>
+
+
+
+<h2 id="相依性(Associativity)">相依性(Associativity)</h2>
+
+<p>當優先序相同時,使用相依性決定運算方向。範例如下:</p>
+
+<pre class="syntaxbox">a OP b OP c
+</pre>
+
+<p>左相依性 (Left-associativity) ,表示處理順序為從左至右 <code>(a OP b) OP c</code>,反之,右相依性(right-associativity) 表示處理順序為從右至左 <code>a OP (b OP c)</code>。賦值運算符 (Assignment operators) 為右相依性,範例如下:</p>
+
+<pre class="brush: js">a = b = 5;
+</pre>
+
+<p><code>a</code> 和 <code>b</code> 的預期結果為 5,因為賦值運算符 (Assignment operator) 為右相依性,因此從右至左返回值。一開始 <code>b</code> 被設定為 5,接著 <code>a</code> 也被設定為 5。</p>
+
+<h2 id="表格(Table)">表格(Table)</h2>
+
+<p>下方表格列出運算子的相依性,從高 (20) 到低 (1)。</p>
+
+<table class="fullwidth-table">
+ <tbody>
+ <tr>
+ <th>優先性<br>
+ Precedence</th>
+ <th>運算子名稱<br>
+ Operator type</th>
+ <th>相依性<br>
+ Associativity</th>
+ <th>運算子<br>
+ Individual operators</th>
+ </tr>
+ <tr>
+ <td>20</td>
+ <td>{{jsxref("Operators/Grouping", "Grouping")}}</td>
+ <td>無</td>
+ <td><code>( … )</code></td>
+ </tr>
+ <tr>
+ <td colspan="1" rowspan="4">19</td>
+ <td>{{jsxref("Operators/Property_Accessors", "Member Access", "#Dot_notation")}}</td>
+ <td>從左至右</td>
+ <td><code>… . …</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Operators/Property_Accessors", "Computed Member Access","#Bracket_notation")}}</td>
+ <td>從左至右</td>
+ <td><code>… [ … ]</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Operators/new","new")}} (with argument list)</td>
+ <td>無</td>
+ <td><code>new … ( … )</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Guide/Functions">Function Call</a></td>
+ <td>從左至右</td>
+ <td><code>… ( <var>… </var>)</code></td>
+ </tr>
+ <tr>
+ <td rowspan="1">18</td>
+ <td>{{jsxref("Operators/new","new")}} (without argument list)</td>
+ <td>從右至左</td>
+ <td><code>new …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="2">17</td>
+ <td>{{jsxref("Operators/Arithmetic_Operators","Postfix Increment","#Increment")}}</td>
+ <td colspan="1" rowspan="2">無</td>
+ <td><code>… ++</code></td>
+ </tr>
+ <tr>
+ <td>{{jsxref("Operators/Arithmetic_Operators","Postfix Decrement","#Decrement")}}</td>
+ <td><code>… --</code></td>
+ </tr>
+ <tr>
+ <td colspan="1" rowspan="10">16</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT">Logical NOT</a></td>
+ <td colspan="1" rowspan="10">從右至左</td>
+ <td><code>! …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT">Bitwise NOT</a></td>
+ <td><code>~ …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus">Unary Plus</a></td>
+ <td><code>+ …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_negation">Unary Negation</a></td>
+ <td><code>- …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment">Prefix Increment</a></td>
+ <td><code>++ …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement">Prefix Decrement</a></td>
+ <td><code>-- …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a></td>
+ <td><code>typeof …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/void">void</a></td>
+ <td><code>void …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete">delete</a></td>
+ <td><code>delete …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a></td>
+ <td><code>await …</code></td>
+ </tr>
+ <tr>
+ <td>15</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation">Exponentiation</a></td>
+ <td>從右至左</td>
+ <td><code>… ** …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="3">14</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Multiplication">Multiplication</a></td>
+ <td colspan="1" rowspan="3">從左至右</td>
+ <td><code>… * …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Division">Division</a></td>
+ <td><code>… / …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder">Remainder</a></td>
+ <td><code>… % …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="2">13</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition">Addition</a></td>
+ <td colspan="1" rowspan="2">從左至右</td>
+ <td><code>… + …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Subtraction">Subtraction</a></td>
+ <td><code>… - …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="3">12</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Left Shift</a></td>
+ <td colspan="1" rowspan="3">從左至右</td>
+ <td><code>… &lt;&lt; …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Right Shift</a></td>
+ <td><code>… &gt;&gt; …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Unsigned Right Shift</a></td>
+ <td><code>… &gt;&gt;&gt; …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="6">11</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_operator">Less Than</a></td>
+ <td colspan="1" rowspan="6">從左至右</td>
+ <td><code>… &lt; …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than__or_equal_operator">Less Than Or Equal</a></td>
+ <td><code>… &lt;= …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator">Greater Than</a></td>
+ <td><code>… &gt; …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_or_equal_operator">Greater Than Or Equal</a></td>
+ <td><code>… &gt;= …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/in">in</a></td>
+ <td><code>… in …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/instanceof">instanceof</a></td>
+ <td><code>… instanceof …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="4">10</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality">Equality</a></td>
+ <td colspan="1" rowspan="4">從左至右</td>
+ <td><code>… == …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Inequality">Inequality</a></td>
+ <td><code>… != …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Identity">Strict Equality</a></td>
+ <td><code>… === …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity">Strict Inequality</a></td>
+ <td><code>… !== …</code></td>
+ </tr>
+ <tr>
+ <td>9</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_AND">Bitwise AND</a></td>
+ <td>從左至右</td>
+ <td><code>… &amp; …</code></td>
+ </tr>
+ <tr>
+ <td>8</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR">Bitwise XOR</a></td>
+ <td>從左至右</td>
+ <td><code>… ^ …</code></td>
+ </tr>
+ <tr>
+ <td>7</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_OR">Bitwise OR</a></td>
+ <td>從左至右</td>
+ <td><code>… | …</code></td>
+ </tr>
+ <tr>
+ <td>6</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND">Logical AND</a></td>
+ <td>從左至右</td>
+ <td><code>… &amp;&amp; …</code></td>
+ </tr>
+ <tr>
+ <td>5</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR">Logical OR</a></td>
+ <td>從左至右</td>
+ <td><code>… || …</code></td>
+ </tr>
+ <tr>
+ <td>4</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator">Conditional</a></td>
+ <td>從右至左</td>
+ <td><code>… ? … : …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="13">3</td>
+ <td rowspan="13"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators">Assignment</a></td>
+ <td rowspan="13">從右至左</td>
+ <td><code>… = …</code></td>
+ </tr>
+ <tr>
+ <td><code>… += …</code></td>
+ </tr>
+ <tr>
+ <td><code>… -= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… **= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… *= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… /= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… %= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… &lt;&lt;= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… &gt;&gt;= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… &gt;&gt;&gt;= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… &amp;= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… ^= …</code></td>
+ </tr>
+ <tr>
+ <td><code>… |= …</code></td>
+ </tr>
+ <tr>
+ <td rowspan="2">2</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/yield">yield</a></td>
+ <td colspan="1" rowspan="2">從右至左</td>
+ <td><code>yield …</code></td>
+ </tr>
+ <tr>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/yield*">yield*</a></td>
+ <td><code>yield* …</code></td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator">Comma / Sequence</a></td>
+ <td>從左至右</td>
+ <td><code>… , …</code></td>
+ </tr>
+ </tbody>
+</table>
diff --git a/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html
new file mode 100644
index 0000000000..a0b8edeae6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/optional_chaining/index.html
@@ -0,0 +1,195 @@
+---
+title: 可選串連
+slug: Web/JavaScript/Reference/Operators/Optional_chaining
+tags:
+ - JavaScript
+ - 串連
+ - 可選串連
+ - 語言功能
+ - 運算子
+translation_of: Web/JavaScript/Reference/Operators/Optional_chaining
+---
+<div>{{JSSidebar("Operators")}}</div>
+
+<div></div>
+
+<p><strong>可選串連</strong>運算子 <strong><code>?.</code></strong> 允許進行深層次的物件值存取,而無需透過明確的物件值串連驗證。<span class="seoSummary"><code>?.</code> 運算子的操作與 <code>.</code> 屬性存取運算子相似,後者會在參照到 <a href="/zh-TW/docs/Glossary/nullish">nullish</a> ({{JSxRef("null")}} or {{JSxRef("undefined")}}) 的值時出現錯誤,而前者可選串連則回傳 <code>undefined</code> 。</span> 當需要存取一個函數,而這函數並不存在時,則會回傳 <code>undefined</code> 。</p>
+
+<p>當有機會存在參照不存在的時候,可選串連可以提供更簡短的表述式來進行串連性的屬性存取。這有助於在無法保證物件屬性為必要存在的狀況下,進行物件內容的探索。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-optionalchainingoperator.html", "taller")}}</div>
+
+<div></div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><var>obj</var>?.<var>prop</var>
+<var>obj</var>?.[<var>expr</var>]
+<em>arr</em>?.[<var>index</var>]
+<var>func</var>?.(<var>args</var>)
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>當串連物件裡面的參照或方法可能是<code>undefined</code> 或 <code>null</code> 時,可選串連運算子提供簡單的方法去存取這些串連物件下的值。</p>
+
+<p>舉例來說,當一個物件 <code>obj</code> 是巢狀結構時,在沒有可選串連之下,要去查找一深層的屬性值需要驗證每層間的參照連結:</p>
+
+<pre class="brush: js">let nestedProp = obj.first &amp;&amp; obj.first.second;</pre>
+
+<p><code>obj.first</code> 的值需要先確定不是 <code>null</code> 值(和並非 <code>undefined</code> ),才能存取 <code>obj.first.second</code> 的值。這才能避免在存取值時,因為直接使用 <code>obj.first.second</code> 而沒有測試 <code>obj.first</code> 之下帶來的錯誤。</p>
+
+<p>當使用了可選串連運算子(<code>?.</code>),你不再需要明確地進行測測,並能在基於 <code>obj.first</code> 的狀態下直接回傳,忽略存取 <code>obj.first.second</code> 的動作:</p>
+
+<pre class="brush: js">let nestedProp = obj.first?.second;</pre>
+
+<p>從只是 <code>.</code> 改用作 <code>?.</code> 運算子,JavaScript 會知道在存取 <code>obj.first.second</code> 之前,需要間接地檢查並確保 <code>obj.first</code> 並不是 <code>null</code> 或 <code>undefined</code> 。當 <code>obj.first</code> 是 <code>null</code> 或 <code>undefined</code> ,運算式會像短路一樣跳過整個串連存取式,而回傳 <code>undefined</code> 。</p>
+
+<p>這是跟以下是相等同的,但是實際上是不會建立臨時變數:</p>
+
+<pre class="brush: js">let temp = obj.first;
+let nestedProp = ((temp === null || temp === undefined) ? undefined : temp.second);
+</pre>
+
+<h3 id="可選串連呼叫函數">可選串連呼叫函數</h3>
+
+<p>你可以使用可選串連來嘗試呼叫一個或許沒有存在的方法。這可能有助於,舉例來說,使用一些未能提供服務的 API ,這可能因為過時的應用或是使用者的裝置未能支援某種功能。</p>
+
+<p>當需要使用的方法並不存在時,透過可選串連去進行呼叫將不會抛出錯誤,取而代之的是回傳 <code>undefined</code> :</p>
+
+<pre class="brush: js">let result = someInterface.customMethod?.();</pre>
+
+<div class="blockIndicator note">
+<p><strong>注意:</strong> 假如物件有同樣的屬性名稱,而不是一個方法,使用 <code>?.</code> 將會抛出 {{JSxRef("TypeError")}} 錯誤(<code>x.y</code><code> 不是一個函數</code>.</p>
+</div>
+
+<h4 id="處理回呼函式或事件處理器">處理回呼函式或事件處理器</h4>
+
+<p>如果你使用回呼函式,或是透過<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring">解構賦值</a>來擷取物件中的方法,你可能會因為這些方法沒有存在,而無法進行呼叫,除非你事先驗證其存在性。所以,你可以利用 <code>?.</code> 來避免這樣的測試:</p>
+
+<pre class="brush: js">// 在 ES2019 下撰寫
+function doSomething(onContent, onError) {
+ try {
+ // ... 對資料進行一些處理
+ }
+ catch (err) {
+ if (onError) { // 測試 onError 是否真的存在
+ onError(err.message);
+ }
+ }
+}
+</pre>
+
+<pre class="brush: js">// 使用可選串連進行函式呼叫
+function doSomething(onContent, onError) {
+ try {
+ // ... 對資料進行一些處理
+ }
+ catch (err) {
+ onError?.(err.message); // 就算 onError 是 undefined 也不會抛出錯誤
+ }
+}
+</pre>
+
+<h3 id="可選串連表述式">可選串連表述式</h3>
+
+<p>你也可以在<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Property_Accessors#Bracket_notation">方括號屬性存取</a>表達式中使用可選串連:</p>
+
+<pre class="brush: js">let nestedProp = obj?.['prop' + 'Name'];
+</pre>
+
+<h3 id="矩陣項目的可選串連">矩陣項目的可選串連</h3>
+
+<pre class="brush: js">let arrayItem = arr?.[42];</pre>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="基本範例">基本範例</h3>
+
+<p>這個範例會找出 Map 物件中一個鍵為 <code>bar</code> 成員的 <code>name</code> 屬性值,但事實上並沒有相關成員。所以結果為 <code>undefined</code> 。</p>
+
+<pre class="brush: js">let myMap = new Map();
+myMap.set("foo", {name: "baz", desc: "inga"});
+
+let nameBar = myMap.get("bar")?.name;</pre>
+
+<h3 id="短路式運算">短路式運算</h3>
+
+<p>當可選串連接上表述式時,如果左邊的運算數值是 <code>null</code> 或 <code>undefined</code> ,表述式則不會被運算。舉例來說:</p>
+
+<pre class="brush: js">let potentiallyNullObj = null;
+let x = 0;
+let prop = potentiallyNullObj?.[x++];
+
+console.log(x); // 因為 x 沒有遞增,所以為 0
+</pre>
+
+<h3 id="串接多個可選串連">串接多個可選串連</h3>
+
+<p>在巢狀結構中可以使用多次的可選串連:</p>
+
+<pre class="brush: js">let customer = {
+ name: "Carl",
+ details: {
+ age: 82,
+ location: "Paradise Falls" // 詳細地址 address 並不知道
+ }
+};
+let customerCity = customer.details?.address?.city;
+
+// … 同樣地,串接多個可選串連來呼叫函式也是湊效的
+let duration = vacations.trip?.getTime?.();
+</pre>
+
+<h3 id="使用空值合併運算子">使用空值合併運算子</h3>
+
+<p>在可選串連後可以使用{{JSxRef("Operators/Nullish_Coalescing_Operator", "空值合併運算子", '', 1)}}來編配預設值,如果無法在屬性串連中取得值:</p>
+
+<pre class="brush: js">let customer = {
+ name: "Carl",
+ details: { age: 82 }
+};
+const customerCity = customer?.city ?? "Unknown city";
+console.log(customerCity); // Unknown city</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><a href="https://tc39.es/proposal-optional-chaining/#sec-scope">Proposal for the "optional chaining" operator</a></td>
+ <td>Stage 4</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.operators.optional_chaining")}}</p>
+</div>
+
+<h3 id="實施進程">實施進程</h3>
+
+<p>因為本功能尚未達到跨瀏覽器性穩定,以下表格提供本功能的每天實驗狀態。資料是透過在各瀏覽器 nightly build 或最新版本 JavaScript 引擎中,進行<a href="https://github.com/tc39/test262">Test262</a> (一個 JavaScript 的標準測試包) 中相關測試而生成的。</p>
+
+<div>{{EmbedTest262ReportResultsTable("optional-chaining")}}</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{JSxRef("Operators/Nullish_Coalescing_Operator", "空值合併運算子", '', 1)}}</li>
+ <li><a href="https://github.com/tc39/proposals">TC39 proposals</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html b/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html
new file mode 100644
index 0000000000..fe6ea9a383
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/spread_syntax/index.html
@@ -0,0 +1,248 @@
+---
+title: Spread syntax (...)
+slug: Web/JavaScript/Reference/Operators/Spread_syntax
+translation_of: Web/JavaScript/Reference/Operators/Spread_syntax
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p><strong>展開運算子</strong>(<code>...</code>) 允許可迭代的陣列或字串展開成0到多個參數(如果是function的話)或是0到多個元素(如果是array或字組的話),或如果是物件的話則展開成0到多個key-value pair。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-spreadsyntax.html")}}</div>
+
+<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div>
+
+<h2 id="語法">語法</h2>
+
+<p>用在呼叫函式時:</p>
+
+<pre class="syntaxbox notranslate"><var>myFunction</var>(...<var>iterableObj</var>);
+</pre>
+
+<p>用在陣列或字串時:</p>
+
+<pre class="syntaxbox notranslate">[...<var>iterableObj</var>, '4', 'five', 6];</pre>
+
+<p>用在物件時(new in ECMAScript 2018):</p>
+
+<pre class="syntaxbox notranslate">let <var>objClone</var> = { ...<var>obj</var> };</pre>
+
+<h2 id="Rest_syntax_parameters">Rest syntax (parameters)</h2>
+
+<p>Rest syntax looks exactly like spread syntax. In a way, rest syntax is the opposite of spread syntax. Spread syntax "expands" an array into its elements, while rest syntax collects multiple elements and "condenses" them into a single element. See {{jsxref("Functions/rest_parameters", "rest parameters", "", 1)}}.</p>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="Spread_in_function_calls">Spread in function calls</h3>
+
+<h4 id="Replace_apply">Replace apply()</h4>
+
+<p>It is common to use {{jsxref("Function.prototype.apply()")}} in cases where you want to use the elements of an array as arguments to a function.</p>
+
+<pre class="brush: js notranslate">function myFunction(x, y, z) { }
+const args = [0, 1, 2];
+myFunction.apply(null, args);</pre>
+
+<p>With spread syntax the above can be written as:</p>
+
+<pre class="brush: js notranslate">function myFunction(x, y, z) { }
+const args = [0, 1, 2];
+myFunction(...args);</pre>
+
+<p>Any argument in the argument list can use spread syntax, and the spread syntax can be used multiple times.</p>
+
+<pre class="brush: js notranslate">function myFunction(v, w, x, y, z) { }
+const args = [0, 1];
+myFunction(-1, ...args, 2, ...[3]);</pre>
+
+<h4 id="Apply_for_new_operator">Apply for new operator</h4>
+
+<p>When calling a constructor with {{jsxref("Operators/new", "new")}} it's not possible to <strong>directly</strong> use an array and <code>apply()</code> (<code>apply()</code> does a <code>[[Call]]</code> and not a <code>[[Construct]]</code>). However, an array can be easily used with <code>new</code> thanks to spread syntax:</p>
+
+<pre class="brush: js notranslate">const dateFields = [1970, 0, 1]; // 1 Jan 1970
+const d = new Date(...dateFields);
+</pre>
+
+<p>To use <code>new</code> with an array of parameters without spread syntax, you would have to do it <strong>indirectly</strong> through partial application:</p>
+
+<pre class="brush: js notranslate">function applyAndNew(constructor, args) {
+ function partial () {
+ return constructor.apply(this, args);
+ };
+ if (typeof constructor.prototype === "object") {
+ partial.prototype = Object.create(constructor.prototype);
+ }
+ return partial;
+}
+
+
+function myConstructor () {
+ console.log("arguments.length: " + arguments.length);
+ console.log(arguments);
+ this.prop1="val1";
+ this.prop2="val2";
+};
+
+const myArguments = ["hi", "how", "are", "you", "mr", null];
+const myConstructorWithArguments = applyAndNew(myConstructor, myArguments);
+
+console.log(new myConstructorWithArguments);
+// (internal log of myConstructor): arguments.length: 6
+// (internal log of myConstructor): ["hi", "how", "are", "you", "mr", null]
+// (log of "new myConstructorWithArguments"): {prop1: "val1", prop2: "val2"}</pre>
+
+<h3 id="Spread_in_array_literals">Spread in array literals</h3>
+
+<h4 id="A_more_powerful_array_literal">A more powerful array literal</h4>
+
+<p>Without spread syntax, to create a new array using an existing array as one part of it, the array literal syntax is no longer sufficient and imperative code must be used instead using a combination of {{jsxref("Array.prototype.push", "push()")}}, {{jsxref("Array.prototype.splice", "splice()")}}, {{jsxref("Array.prototype.concat", "concat()")}}, etc. With spread syntax this becomes much more succinct:</p>
+
+<pre class="brush: js notranslate">const parts = ['shoulders', 'knees'];
+const lyrics = ['head', ...parts, 'and', 'toes'];
+// ["head", "shoulders", "knees", "and", "toes"]
+</pre>
+
+<p>Just like spread for argument lists, <code>...</code> can be used anywhere in the array literal, and may be used more than once.</p>
+
+<h4 id="Copy_an_array">Copy an array</h4>
+
+<pre class="brush: js notranslate">const arr = [1, 2, 3];
+const arr2 = [...arr]; // like arr.slice()
+
+arr2.push(4);
+// arr2 becomes [1, 2, 3, 4]
+// arr remains unaffected
+</pre>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> Spread syntax effectively goes one level deep while copying an array. Therefore, it may be unsuitable for copying multidimensional arrays, as the following example shows. (The same is true with {{jsxref("Object.assign()")}} and spread syntax.)</p>
+
+<pre class="brush: js example-bad notranslate">const a = [[1], [2], [3]];
+const b = [...a];
+
+b.shift().shift();
+// 1
+
+// Oh no! Now array 'a' is affected as well:
+a
+// [[], [2], [3]]
+</pre>
+</div>
+
+<h4 id="A_better_way_to_concatenate_arrays">A better way to concatenate arrays</h4>
+
+<p>{{jsxref("Array.prototype.concat()")}} is often used to concatenate an array to the end of an existing array. Without spread syntax, this is done as:</p>
+
+<pre class="brush: js notranslate">const arr1 = [0, 1, 2];
+const arr2 = [3, 4, 5];
+
+// Append all items from arr2 onto arr1
+arr1 = arr1.concat(arr2);</pre>
+
+<p>With spread syntax this becomes:</p>
+
+<pre class="brush: js notranslate">let arr1 = [0, 1, 2];
+let arr2 = [3, 4, 5];
+
+arr1 = [...arr1, ...arr2];
+// arr1 is now [0, 1, 2, 3, 4, 5]
+// Note: Not to use const otherwise, it will give TypeError (invalid assignment)
+</pre>
+
+<p>{{jsxref("Array.prototype.unshift()")}} is often used to insert an array of values at the start of an existing array. Without spread syntax, this is done as:</p>
+
+<pre class="brush: js notranslate">const arr1 = [0, 1, 2];
+const arr2 = [3, 4, 5];
+
+// Prepend all items from arr2 onto arr1
+Array.prototype.unshift.apply(arr1, arr2)
+
+// arr1 is now [3, 4, 5, 0, 1, 2]</pre>
+
+<p>With spread syntax, this becomes:</p>
+
+<pre class="brush: js notranslate">let arr1 = [0, 1, 2];
+let arr2 = [3, 4, 5];
+
+arr1 = [...arr2, ...arr1];
+// arr1 is now [3, 4, 5, 0, 1, 2]
+</pre>
+
+<div class="blockIndicator note">
+<p><strong>Note:</strong> Unlike <code>unshift()</code>, this creates a new <code>arr1</code>, and does not modify the original <code>arr1</code> array in-place.</p>
+</div>
+
+<h3 id="Spread_in_object_literals">Spread in object literals</h3>
+
+<p>The <a href="https://github.com/tc39/proposal-object-rest-spread">Rest/Spread Properties for ECMAScript</a> proposal (ES2018) added spread properties to {{jsxref("Operators/Object_initializer", "object literals", 1)}}. It copies own enumerable properties from a provided object onto a new object.</p>
+
+<p>Shallow-cloning (excluding prototype) or merging of objects is now possible using a shorter syntax than {{jsxref("Object.assign()")}}.</p>
+
+<pre class="brush: js notranslate">const obj1 = { foo: 'bar', x: 42 };
+const obj2 = { foo: 'baz', y: 13 };
+
+const clonedObj = { ...obj1 };
+// Object { foo: "bar", x: 42 }
+
+const mergedObj = { ...obj1, ...obj2 };
+// Object { foo: "baz", x: 42, y: 13 }</pre>
+
+<p>Note that {{jsxref("Object.assign()")}} triggers {{jsxref("Functions/set", "setters")}}, whereas spread syntax doesn't.</p>
+
+<p>Note that you cannot replace or mimic the {{jsxref("Object.assign()")}} function:</p>
+
+<pre class="brush: js notranslate">let obj1 = { foo: 'bar', x: 42 };
+let obj2 = { foo: 'baz', y: 13 };
+const merge = ( ...objects ) =&gt; ( { ...objects } );
+
+let mergedObj1 = merge (obj1, obj2);
+// Object { 0: { foo: 'bar', x: 42 }, 1: { foo: 'baz', y: 13 } }
+
+let mergedObj2 = merge ({}, obj1, obj2);
+// Object { 0: {}, 1: { foo: 'bar', x: 42 }, 2: { foo: 'baz', y: 13 } }</pre>
+
+<p>In the above example, the spread syntax does not work as one might expect: it spreads an <em>array</em> of arguments into the object literal, due to the rest parameter.</p>
+
+<h3 id="Only_for_iterables">Only for iterables</h3>
+
+<p>Objects themselves are not iterable, but they become iterable when used in an Array, or with iterating functions such as <code>map()</code>, <code>reduce()</code>, and <code>assign()</code>. When merging 2 objects together with the spread operator, it is assumed another iterating function is used when the merging occurs.</p>
+
+<p>Spread syntax (other than in the case of spread properties) can be applied only to <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator">iterable</a> objects:</p>
+
+<pre class="brush: js notranslate">const obj = {'key1': 'value1'};
+const array = [...obj]; // TypeError: obj is not iterable
+</pre>
+
+<h3 id="Spread_with_many_values">Spread with many values</h3>
+
+<p>When using spread syntax for function calls, be aware of the possibility of exceeding the JavaScript engine's argument length limit. See {{jsxref("Function.prototype.apply", "apply()")}} for more details.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-array-initializer', 'Array initializer')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object-initializer', 'Object initializer')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.operators.spread")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Functions/rest_parameters", "Rest parameters", "", 1)}} (also ‘<code>...</code>’)</li>
+ <li>{{jsxref("Function.prototype.apply()")}} (also ‘<code>...</code>’)</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/super/index.html b/files/zh-tw/web/javascript/reference/operators/super/index.html
new file mode 100644
index 0000000000..d02c8a0a91
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/super/index.html
@@ -0,0 +1,179 @@
+---
+title: super
+slug: Web/JavaScript/Reference/Operators/super
+translation_of: Web/JavaScript/Reference/Operators/super
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>super 關鍵字被使用於通過函式存取父層</p>
+
+<p> <code>super.prop</code> 與 <code>super[expr]</code> 表達有效在 <a href="/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions">method definition</a> 與 <a href="/en-US/docs/Web/JavaScript/Reference/Classes">classes</a> 與 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object literals</a>.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">super([arguments]); // calls the parent constructor.
+super.functionOnParent([arguments]);
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>當使用建構子,<code>super</code> 關鍵字必須出現在<code>this</code> 關鍵字之前使用,<code>super</code> 關鍵字也可以使用在呼叫函式與父對象</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="在類別中使用_super">在類別中使用 <code>super</code> </h3>
+
+<p>這個程式碼片段從 <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">classes sample</a> (<a href="https://googlechrome.github.io/samples/classes-es6/index.html">live demo</a>). 這裏的 <code>super()</code> 被呼叫去避免複製到建構子的 <code>Rectangle</code> 與 <code>Square</code> 的共通部分。</p>
+
+<pre class="brush: js">class Rectangle {
+ constructor(height, width) {
+ this.name = 'Rectangle';
+ this.height = height;
+ this.width = width;
+ }
+ sayName() {
+ console.log('Hi, I am a ', this.name + '.');
+ }
+ get area() {
+ return this.height * this.width;
+ }
+ set area(value) {
+ this.area = value;
+ }
+}
+
+class Square extends Rectangle {
+ constructor(length) {
+ this.height; // ReferenceError, super needs to be called first!
+
+ // Here, it calls the parent class's constructor with lengths
+ // provided for the Rectangle's width and height
+ super(length, length);
+
+ // Note: In derived classes, super() must be called before you
+ // can use 'this'. Leaving this out will cause a reference error.
+ this.name = 'Square';
+ }
+}</pre>
+
+<h3 id="Super-calling_靜態方法">Super-calling 靜態方法</h3>
+
+<p>你也可以使用在<a href="/en-US/docs/Web/JavaScript/Reference/Classes/static">靜態</a>方法.</p>
+
+<pre class="brush: js">class Rectangle {
+ constructor() {}
+ static logNbSides() {
+ return 'I have 4 sides';
+ }
+}
+
+class Square extends Rectangle {
+ constructor() {}
+ static logDescription() {
+ return super.logNbSides() + ' which are all equal';
+ }
+}
+Square.logDescription(); // 'I have 4 sides which are all equal'
+</pre>
+
+<h3 id="刪除_super_屬性將拋出錯誤">刪除 super 屬性將拋出錯誤</h3>
+
+<p>你不能使用 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete">delete operator</a> 以及 <code>super.prop</code> 以及 <code>super[expr]</code> 去刪除父層的類別屬性, 不然他會丟出一個錯誤 {{jsxref("ReferenceError")}}.</p>
+
+<pre class="brush: js">class Base {
+ constructor() {}
+ foo() {}
+}
+class Derived extends Base {
+ constructor() {}
+ delete() {
+ delete super.foo; // this is bad
+ }
+}
+
+new Derived().delete(); // ReferenceError: invalid delete involving 'super'. </pre>
+
+<h3 id="super.prop_不能複寫在不能複寫的屬性"><code>super.prop</code> 不能複寫在不能複寫的屬性</h3>
+
+<p>當定義不可寫屬性,例如 {{jsxref("Object.defineProperty")}}, <code>super</code> 不能複寫這個屬性的值.</p>
+
+<pre class="brush: js">class X {
+ constructor() {
+ Object.defineProperty(this, 'prop', {
+ configurable: true,
+ writable: false,
+ value: 1
+ });
+ }
+}
+
+class Y extends X {
+ constructor() {
+ super();
+ }
+ foo() {
+ super.prop = 2; // Cannot overwrite the value.
+ }
+}
+
+var y = new Y();
+y.foo(); // TypeError: "prop" is read-only
+console.log(y.prop); // 1
+</pre>
+
+<h3 id="使用_super.prop_在對象符號">使用 <code>super.prop</code> 在對象符號</h3>
+
+<p>Super 可以使用在 <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer">object initializer / literal</a> 符號. 在這個範例, 有兩個對象定義在一個方法. 在第二個對象裡面, <code>super</code> 呼叫了第一個對象的方法. 這個動作幫助 {{jsxref("Object.setPrototypeOf()")}} 讓我們可以設定原型 <code>obj2</code> to <code>obj1</code>, 所以 <code>super</code> 可以發現 <code>method1</code> 在 <code>obj1</code>裡被找到.</p>
+
+<pre class="brush: js">var obj1 = {
+ method1() {
+ console.log('method 1');
+ }
+}
+
+var obj2 = {
+ method2() {
+ super.method1();
+ }
+}
+
+Object.setPrototypeOf(obj2, obj1);
+obj2.method2(); // logs "method 1"
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-super-keyword', 'super')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-super-keyword', 'super')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.operators.super")}}</p>
+
+<h2 id="參考">參考</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a></li>
+ <li><a href="https://medium.com/beginners-guide-to-mobile-web-development/super-and-extends-in-javascript-es6-understanding-the-tough-parts-6120372d3420">Anurag Majumdar - Super &amp; Extends in JavaScript</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/this/index.html b/files/zh-tw/web/javascript/reference/operators/this/index.html
new file mode 100644
index 0000000000..e26b592244
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/this/index.html
@@ -0,0 +1,385 @@
+---
+title: this
+slug: Web/JavaScript/Reference/Operators/this
+tags:
+ - JavaScript
+ - this
+translation_of: Web/JavaScript/Reference/Operators/this
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>JavaScript <strong>函式內的 <code>this</code> 關鍵字</strong>表現,和其他語言相比略有差異。在<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode">嚴格模式</a>與非嚴格模式下也有所不同。</p>
+
+<p>通常,<code>this</code> 值由被呼叫的函式來決定。它不能在執行期間被指派,每次函式呼叫調用的值也可能不同。ES5 引入了 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">bind</a></code> 方法去<a href="#The_bind_method">設置函式的 <code>this</code> 值,而不管它怎麼被呼叫。</a>ECMAScript 2015 也導入了定義 <code>this</code> 詞法範圍的<a href="../Functions/Arrow_functions">箭頭函式</a>(它的 <code>this</code> 值會維持在詞法作用域)。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-this.html")}}</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">this</pre>
+
+<h2 id="全域環境下">全域環境下</h2>
+
+<p><code>this</code> 值在所有函式以外的全域執行環境下,會被當作全域物件,無論是否處於嚴格模式。</p>
+
+<pre class="brush:js">console.log(this.document === document); // true
+
+// 在網路瀏覽器中,window 物件也是全域物件。
+console.log(this === window); // true
+
+this.a = 37;
+console.log(window.a); // 37
+
+this.b = "MDN";
+console.log(window.b) // "MDN"
+console.log(b) // "MDN"
+</pre>
+
+<h2 id="函式環境下">函式環境下</h2>
+
+<p>在函式內的 <code>this</code> 值取決於該函式如何被呼叫。</p>
+
+<h3 id="簡易呼叫">簡易呼叫</h3>
+
+<p>因為以下程式碼並不處於<a href="/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">嚴謹模式</a>下、而 <code>this</code> 值也沒被呼叫(call)設定,<code>this</code> 會變成全域物件,在瀏覽器之下則會變成 <code>window</code>。</p>
+
+<pre class="brush:js">function f1(){
+ return this;
+}
+
+//在瀏覽器中:
+f1() === window; // true
+
+//Node中:
+f1() === global; // true
+</pre>
+
+<p>然而,在嚴格模式下,<code>this</code> 值會在進入執行環境時建立並維持該狀態。因此,下例的 <code>this</code> 預設值是 <code>undefined</code>:</p>
+
+<pre class="brush:js">function f2(){
+ "use strict"; // 嚴格模式
+ return this;
+}
+
+f2() === undefined; //true</pre>
+
+<p>所以在嚴格模式下,如果 <code>this</code> 沒有定義到執行環境內,其預設值就會是 <code>undefined</code>。</p>
+
+<div class="note">
+<p>在第二個例子裡面,<code>this</code> 應為 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/undefined"><code>undefined</code></a>,因為 <code>f2</code> 是直接被呼叫,而不是在其為某個物件的方法或屬性的情況下(例如 <code>window.f2()</code>)被直接呼叫。某些瀏覽器首次支援<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="Strict mode">嚴格模式</a>時沒導入這個特徵,它們會因此錯誤的回傳 <code>window</code> 物件。</p>
+</div>
+
+<p>要從某個語境訪問另一個 <code>this</code> 語境的值,請使用 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/call">call</a> 或 <a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/apply">apply</a>:</p>
+
+<pre dir="rtl">// 物件可以被當作call或apply的第一個參數,而this會綁定該物件
+var obj = {a: 'Custom'};
+
+// 此屬性a為全域物件
+var a = 'Global';
+
+function whatsThis(arg) {
+ return this.a; // this 值取決於此函數如何被呼叫
+}
+
+whatsThis(); // 'Global'
+whatsThis.call(obj); // 'Custom'
+whatsThis.apply(obj); // 'Custom'
+</pre>
+
+<p>當函式內部調用 <code>this</code> 關鍵字時,其值會和所有繼承自 <code>Function.prototype</code> 並使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/call">call</a></code> 或 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/apply">apply</a></code> 方法呼叫的特定物件綁定。</p>
+
+<pre>function add(c, d) {
+ return this.a + this.b + c + d;
+}
+
+var o = {a: 1, b: 3};
+
+// 第一個參數(parameter)是調用了 this 的物件,
+// 後續參數(parameters)會作為函式呼叫內的參數(arguments)而通過
+add.call(o, 5, 7); // 16
+
+// 第一個參數(parameter)是調用了 this 的物件,
+// 第二個參數的陣列作為函式呼叫內的參數(arguments)之構件
+add.apply(o, [10, 20]); // 34</pre>
+
+<p>使用 <code>call</code> 和 <code>apply</code> 時,如果被輸入作為 <code>this</code> 的值不是物件,JavaScript 內建的 <code>ToObject</code> 運算符會試著把被輸入的值轉變為物件。如果被輸入的值是一個原始型別,例如 <code>7</code>或是 <code>'foo'</code>,它們會自動被相關的建構方法轉變為物件。因此,原始數值<code>7</code>會轉變成類似用<code>new Number(7)</code>產生的物件,而字串<code>'foo'</code>會轉變成類似用<code>new String('foo')</code>產生的物件。</p>
+
+<pre class="brush:js">function bar() {
+ console.log(Object.prototype.toString.call(this));
+}
+
+bar.call(7); // [object Number]
+bar.call('foo'); // [Object String]
+</pre>
+
+<h3 id="bind_方法"><code>bind</code> 方法</h3>
+
+<p>ECMAScript 5 導入了 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Function/bind">Function.prototype.bind</a></code>。呼叫 <code>f.bind(someObject)</code> 會建立和 <code>f</code> 的主體與作用域相同之新函式;但無論函數怎麼被調用,原始函數的 <code>this</code> 在新函數將永遠與 <code>bind</code> 的第一個參數綁定起來。</p>
+
+<pre><code>function f() {
+ return this.a;
+}
+
+var g = f.bind({a: 'azerty'});
+console.log(g()); // azerty
+
+var h = g.bind({a: 'yoo'}); // bind 只能使用一次!
+console.log(h()); // azerty
+
+var o = {a: 37, f: f, g: g, h: h};
+console.log(o.f(), o.g(), o.h()); // 37, azerty, azerty</code>
+</pre>
+
+<h3 id="箭頭函式">箭頭函式</h3>
+
+<p>在<a href="/zh-TW/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭頭函式</a>下,<code>this</code> 值保留了其在詞法作用域 的 <code>this</code> 值。在全域程式碼內,則設為全域物件:</p>
+
+<pre class="brush: js">var globalObject = this;
+var foo = (() =&gt; this);
+console.log(foo() === globalObject); // true</pre>
+
+<div class="note">
+<p>註:如果這參數被傳遞給箭頭函式的 call, bind, apply 調用,該參數會被忽略。你仍然可以將參數預先調用到call,但第一個參數(thisArg)必須設置為空。</p>
+</div>
+
+<pre class="brush: js">// 作為物件的方法呼叫
+var obj = {foo: foo};
+console.log(obj.foo() === globalObject); // true
+
+// 使用呼叫以嘗試設置 this
+console.log(foo.call(obj) === globalObject); // true
+
+// 使用 bind 以嘗試設置 this
+foo = foo.bind(obj);
+console.log(foo() === globalObject); // true</pre>
+
+<p>無論以上哪種,<code>foo</code> 的 <code>this</code> 在建立的時候,都會設為原本的樣子(以上面的例子來說,就是全域物件)。這同樣適用於在其他函式內創建的箭頭函式:它們的 <code>this</code> 是設置為外部執行上下文。</p>
+
+<pre class="brush: js">// 建立一個物件,其方法 bar 含有回傳自己的 this 函式。回傳函式作為箭頭函數而建立,
+// 因此該函式的 this 將永遠與外圍函式(enclosing function)的 this 綁定。
+// bar 的值可在呼叫內設立,which in turn sets the value of the returned function.
+var obj = { bar : function() {
+ var x = (() =&gt; this);
+ return x;
+ }
+ };
+
+// 將 bar 作為物件的方法呼叫,把它的 this 設為物件
+// 指派 fn 作為回傳函數的參照(reference)
+var fn = obj.bar();
+
+// 在不設置 this 情況下呼叫的 fn,通常默認為全域物件,在嚴格模式下則是 undefined
+console.log(fn() === obj); // true</pre>
+
+<p>以上面的程式碼為例,稱作匿名函數(anonymous function)A 的函數被指定為 <code>obj.bar</code>,它回傳的函數(稱作匿名函數 B)作為箭頭函數而建立。因而,函數 B 的 <code>this</code> 在呼叫時,將永遠設為 <code>obj.bar</code> (函數 A)的 <code>this</code>。呼叫被回傳的函數(函數 B)時,它的 <code>this</code> 將一直是原本的樣子。</p>
+
+<p>再以上面的程式碼為例,函數 B 的 <code>this</code> 被設為函數 A 的 <code>this</code>,而它屬於物件,所以它依然會設為 <code>obj</code>,就算在 <code>this</code> 設為 <code>undefined</code> 或全域物件的呼叫方式下(或在全域執行環境下,上例的任何方法)</p>
+
+<h3 id="作為物件方法">作為物件方法</h3>
+
+<p>如果一個函式是以物件的方法呼叫,它的 <code>this</code> 會設為該呼叫函式的物件。</p>
+
+<p>以下面的程式碼為例,呼叫 <code>o.f()</code> 的時候,函式內的 <code>this</code> 會和 <code>o</code> 物件綁定。</p>
+
+<pre class="brush:js">var o = {
+ prop: 37,
+ f: function() {
+ return this.prop;
+ }
+};
+
+console.log(o.f()); // logs 37
+</pre>
+
+<p>請注意這個行為,不會受函式如何或何處定義所影響。以上面為例,在我們定義 <code>o</code> 時,也定義了行內函式 <code>f</code> 作為構件(member)。不過,我們也能先定義函式,接著讓它附屬到 <code>o.f</code>。這麼做會得出相同的效果:</p>
+
+<pre class="brush:js">var o = {prop: 37};
+
+function independent() {
+ return this.prop;
+}
+
+o.f = independent;
+
+console.log(o.f()); // 37
+</pre>
+
+<p>這表明了 <code>this</code> 只和 <code>f</code> 作為 <code>o</code> 的構件呼叫有所關聯。</p>
+
+<p>同樣的,<code>this</code> 綁定只會受最直接的構件引用(most immediate member reference)所影響。在下面的例子,我們將物件 <code>o.b</code> 的方法 <code>g</code> 作為函式呼叫。在執行的期間,函式內的 <code>this</code> 會參照 <code>o.b</code>。物件是否為 <code>o</code> 的構件無關緊要,最直接的引用才是最緊要的。</p>
+
+<pre class="brush:js">o.b = {g: independent, prop: 42};
+console.log(o.b.g()); // logs 42
+</pre>
+
+<h4 id="物件原型鏈上的_this">物件原型鏈上的 <code>this</code></h4>
+
+<p>相同概念也能套用定義物件原型鏈的方法。如果方法放在物件的原型鏈上,<code>this</code> 會指向方法所呼叫的物件,如同該方法在物件上的樣子。</p>
+
+<pre class="brush:js">var o = {f:function(){ return this.a + this.b; }};
+var p = Object.create(o);
+p.a = 1;
+p.b = 4;
+
+console.log(p.f()); // 5
+</pre>
+
+<p>在這個示例中,分配給變數<code>p</code> 的物件沒有自己的 <code>f</code> 屬性, 它(p)繼承了它(o)的原型。但是查找 <code>f</code> 最終在 <code>o</code>上找到它的成員名為 f 並不重要。查找開始作為 <code>p.f</code>的引用,所以 <code>this</code> 在函式內部物件的值被當作是<code>p</code>的引用。也就是說,<code>f</code> 作為 <code>p</code>的調用方法以來, 它的 <code>this</code> 指的就是 <code>p</code>. 這是一個非常有趣的JavaScript's 原型繼承特性。</p>
+
+<h4 id="帶著_getter_或_setter_的_this">帶著 getter 或 setter 的 <code>this</code></h4>
+
+<p>當函式從 getter 或 setter被調用的時候,同樣的概念也成立。用作 getter 或setter 的函式將自己的 <code>this</code> 綁定到從中設置或獲取的物件上。</p>
+
+<pre class="brush:js">function sum(){
+ return this.a + this.b + this.c;
+}
+
+var o = {
+ a: 1,
+ b: 2,
+ c: 3,
+ get average(){
+ return (this.a + this.b + this.c) / 3;
+ }
+};
+
+Object.defineProperty(o, 'sum', {
+ get: sum, enumerable:true, configurable:true});
+
+console.log(o.average, o.sum); // logs 2, 6
+</pre>
+
+<h3 id="作為建構子">作為建構子</h3>
+
+<p>若函式以建構子的身份呼叫(使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/new">new</a></code> 關鍵字) <code>this</code> 會和被建構的新物件綁定。</p>
+
+<div class="note">
+<p>建構子預設透過 <code>this</code> 回傳該物件的參照,但它其實能回傳其他物件。如果回傳值不是物件的話,就會回傳 <code>this</code> 這個物件。</p>
+</div>
+
+<pre class="brush:js">/*
+ * 建構子會如此做動:
+ *
+ * function MyConstructor(){
+ * // 實際的函式主體碼在這裡
+ * // 在|this| 上創建屬性
+ * // 希望通過分配給他們,如:
+ * this.fum = "nom";
+ * // et cetera...
+ *
+ * // 如果函式有返回狀態它將返回一個物件
+ * // 那個物件將是新表達式的結果。
+ * // 換句話來說,表達式的結果是現在綁定 |this| 的物件
+ * // (例如,最常見的常見情況).
+ * }
+ */
+
+function C(){
+ this.a = 37;
+}
+
+var o = new C();
+console.log(o.a); // logs 37
+
+
+function C2(){
+ this.a = 37;
+ return {a:38};
+}
+
+o = new C2();
+console.log(o.a); // logs 38
+</pre>
+
+<p>在上例的 <code>C2</code>,由於物件在建構的時候被呼叫,新的物件 <code>this</code> was bound to simply gets discarded。這也實質上令 <code>this.a = 37;</code> 宣告死亡:不是真的死亡(因為已經執行了),但它在毫無 outside effects 的情況下遭到消滅。</p>
+
+<h3 id="作為_DOM_事件處理器">作為 DOM 事件處理器</h3>
+
+<p>當一個函式用作事件處理器的話,<code>this</code> 值會設在觸發事件的元素(某些瀏覽器如果不用 <code>addEventListener</code> 方法的話,在動態添加監聽器時,就不會遵循這個常規)</p>
+
+<pre class="brush:js">// 當監聽器被調用,相關元素變為藍色
+function bluify(e){
+ // 永遠是真
+ console.log(this === e.currentTarget);
+ // 當當前目標和目標為相同物件為真
+ console.log(this === e.target);
+ this.style.backgroundColor = '#A5D9F3';
+}
+
+// 取得文件內所有的元素
+var elements = document.getElementsByTagName('*');
+
+// Add bluify as a click listener so when the
+// element is clicked on, it turns blue
+for(var i=0 ; i&lt;elements.length ; i++){
+ elements[i].addEventListener('click', bluify, false);
+}</pre>
+
+<h3 id="作為行內事件處理器">作為行內事件處理器</h3>
+
+<p>當程式碼從行內的<a href="/zh-TW/docs/Web/Guide/Events/Event_handlers"> on 事件處理器</a>呼叫的話,<code>this</code> 就會設在監聽器所置的 DOM 元素:</p>
+
+<pre class="brush:js">&lt;button onclick="alert(this.tagName.toLowerCase());"&gt;
+ Show this
+&lt;/button&gt;
+</pre>
+
+<p>上方的 alert 會秀出 <code>button</code>。但請注意只有外層程式碼的 <code>this</code> 要這樣設定:</p>
+
+<pre class="brush:js">&lt;button onclick="alert((function(){return this})());"&gt;
+ Show inner this
+&lt;/button&gt;
+</pre>
+
+<p>在這裡,內部函式的並沒有設立 <code>this</code>,所以它會回傳全域/window 物件(例如在非嚴格模式下,呼叫函數沒設定 <code>this</code> 的預設物件)</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-this-keyword', 'The this keyword')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-this-keyword', 'The this keyword')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-11.1.1', 'The this keyword')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3', '#sec-11.1.1', 'The this keyword')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-11.1.1', 'The this keyword')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義。在 JavaScript 1.0 導入。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div class="hidden">此頁面上的兼容性數據生成自結構化數據。如果你想為數據做出貢獻,請產看<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 並且向我們發送拉取請求。</div>
+
+<p>{{Compat("javascript.operators.this")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode">嚴格模式</a></li>
+ <li><a href="http://bjorn.tipling.com/all-this">All this</a>,一篇關於 <code>this</code> 上下文不同的相關文章</li>
+ <li><a href="http://rainsoft.io/gentle-explanation-of-this-in-javascript/">親和地解釋 JavaScript 的「this」關鍵字</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/operators/typeof/index.html b/files/zh-tw/web/javascript/reference/operators/typeof/index.html
new file mode 100644
index 0000000000..d1939e5d4f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/operators/typeof/index.html
@@ -0,0 +1,177 @@
+---
+title: typeof
+slug: Web/JavaScript/Reference/Operators/typeof
+tags:
+ - 運算子
+translation_of: Web/JavaScript/Reference/Operators/typeof
+---
+<p>{{jsSidebar("Operators")}}</p>
+
+<h2 id="摘要">摘要</h2>
+
+<p style="line-height: 22px;"><span style="line-height: 1.572;">typeof 運算子會傳回一個字串值, 指出未經運算 (unevaluated) 的運算元所代表的型別。</span></p>
+
+<table class="standard-table" style="line-height: 22px;">
+ <thead>
+ <tr>
+ <th colspan="2" scope="col">運算子</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>實作於:</td>
+ <td>JavaScript 1.1</td>
+ </tr>
+ <tr>
+ <td>ECMA 版本:</td>
+ <td>ECMA-262 (以及 ECMA-357 for E4X objects)</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="語法">語法</h2>
+
+<p style="line-height: 22px;"><code style="font-size: 14px;">typeof</code> 之後面跟著它的唯一運算元:</p>
+
+<pre style="font-size: 14px;"><code style="font-size: 14px;">typeof <code style="font-size: 14px;"><em>operand</em></code></code></pre>
+
+<h2 id="Parameters" name="Parameters" style="margin: 0px 0px 0.8em; padding: 0px;">參數</h2>
+
+<div><code style="line-height: inherit; font-size: 14px;"><em>operand</em></code><span style="line-height: inherit;"> 表示式代表傳入的物件或原始型別。</span></div>
+
+<h2 id="Description" name="Description">說明</h2>
+
+<p>下表摘要列出了 <code>typeof 可能的傳回值</code>:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">型別</th>
+ <th scope="col">傳回</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Undefined</td>
+ <td><code>"undefined"</code></td>
+ </tr>
+ <tr>
+ <td>Null</td>
+ <td><code>"object"</code></td>
+ </tr>
+ <tr>
+ <td>Boolean</td>
+ <td><code>"boolean"</code></td>
+ </tr>
+ <tr>
+ <td>Number</td>
+ <td><code>"number"</code></td>
+ </tr>
+ <tr>
+ <td>String</td>
+ <td><code>"string"</code></td>
+ </tr>
+ <tr>
+ <td>主機端物件 (由 JS 執行環境提供)</td>
+ <td><em>視實作方式而異</em></td>
+ </tr>
+ <tr>
+ <td>Function 物件 (實作 ECMA-262 所定義的 [[Call]])</td>
+ <td><code>"function"</code></td>
+ </tr>
+ <tr>
+ <td>E4X XML 物件</td>
+ <td>"xml"</td>
+ </tr>
+ <tr>
+ <td>E4X XMLList 物件</td>
+ <td>"xml"</td>
+ </tr>
+ <tr>
+ <td>所有其它物件</td>
+ <td><code>"object"</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="一般情況">一般情況</h3>
+
+<pre class="brush:js">// Numbers
+typeof 37 === 'number';
+typeof 3.14 === 'number';
+typeof Math.LN2 === 'number';
+typeof Infinity === 'number';
+typeof NaN === 'number'; // 雖然是 "Not-A-Number"
+typeof Number(1) === 'number'; // 但是不要使用這種方式!
+
+// Strings
+typeof "" === 'string';
+typeof "bla" === 'string';
+typeof (typeof 1) === 'string'; // typeof 一律會傳回一個字串
+typeof String("abc") === 'string'; // 但是不要使用這種方式!
+
+// Booleans
+typeof true === 'boolean';
+typeof false === 'boolean';
+typeof Boolean(true) === 'boolean'; // 但是不要使用這種方式!
+
+// Undefined
+typeof undefined === 'undefined';
+typeof blabla === 'undefined'; // 一個 undefined 變數
+
+// Objects
+typeof {a:1} === 'object';
+typeof [1, 2, 4] === 'object'; // 請使用 Array.isArray 或者 Object.prototype.toString.call 以區分正規運算式和陣列
+typeof new Date() === 'object';
+
+typeof new Boolean(true) === 'object'; // 這樣會令人混淆。不要這樣用!
+typeof new Number(1) === 'object'; // 這樣會令人混淆。不要這樣用!
+typeof new String("abc") === 'object'; // 這樣會令人混淆。不要這樣用!
+
+// Functions
+typeof function(){} === 'function';
+typeof Math.sin === 'function';
+</pre>
+
+<h3 id="null"><code>null</code></h3>
+
+<pre class="brush:js">typeof null === 'object'; // 自從有 JavaScript 開始就是這樣了
+</pre>
+
+<p>自從 JavaScript 一開始出現, JavaScript 的值就總以型別標簽跟著一個值的方式表示。物件的型別標簽是 0. 而 <code>null</code> 這個值是使用 NULL 指標 (在大部份平台上是 0x00) 來表示. 因此, null 看起來像是一個以 0 為型別標簽的值, 並使得 <code>typeof</code> 傳回不甚正確的結果. (<a href="http://www.2ality.com/2013/10/typeof-null.html">參考來源</a>)</p>
+
+<p>這個問題已計畫<a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null">在下一版 ECMAScript 予以修正</a> (會以 opt-in 方式提供). 屆時它將會做出如 <code>typeof null === 'null'</code> 的正確回傳結果。</p>
+
+<div class="note">
+<p>註: 此修正計畫已被拒絕</p>
+</div>
+
+<h3 id="正規表示式_(Regular_expressions)">正規表示式 (Regular expressions)</h3>
+
+<p>可呼叫的正規表示式在某些瀏覽器上面必須借助非正式插件 (need reference to say which).</p>
+
+<pre class="brush:js">typeof /s/ === 'function'; // Chrome 1-12 ... // 不符合 ECMAScript 5.1 (譯註: 在新版 Chrome 已修正為 'object')
+typeof /s/ === 'object'; // Firefox 5+ ... // 符合 ECMAScript 5.1
+</pre>
+
+<h3 id="其它怪異輸入_(quirks)">其它怪異輸入 (quirks)</h3>
+
+<h4 id="舊版_Internet_Explorer_請留意_alert_函數">舊版 Internet Explorer 請留意 alert 函數</h4>
+
+<p>在 IE 6, 7 和 8, <code>typeof alert === 'object'</code></p>
+
+<div class="note">
+<p>註: 這並不怪異。這是實情。在許多較舊的 IE 中, 主機端物件的確是物件, 而非函數</p>
+</div>
+
+<h2 id="規格">規格</h2>
+
+<p><a class="external" href="http://ecma-international.org/ecma-262/5.1/#sec-11.4.3">ECMA-262 section 11.4.3</a></p>
+
+<h2 id="See_also" name="See_also">參照</h2>
+
+<ul>
+ <li><a href="/en-US/docs/JavaScript/Reference/Operators/instanceof" title="/en-US/docs/JavaScript/Reference/Operators/instanceof">instanceof</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/async_function/index.html b/files/zh-tw/web/javascript/reference/statements/async_function/index.html
new file mode 100644
index 0000000000..ced67f4a09
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/async_function/index.html
@@ -0,0 +1,163 @@
+---
+title: async function
+slug: Web/JavaScript/Reference/Statements/async_function
+tags:
+ - JavaScript
+ - 函式
+ - 實驗
+ - 範例
+ - 陳述
+translation_of: Web/JavaScript/Reference/Statements/async_function
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><code><strong>async function</strong></code> 宣告被定義為一個回傳 {{jsxref("Global_Objects/AsyncFunction","AsyncFunction")}} 物件的<em>非同步函式</em> 。</p>
+
+<div class="noinclude">
+<p>你也可以使用 {{jsxref("Operators/async_function", "async function expression", "", 1)}} 來定義一個<em>非同步函式</em>。</p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">async function <em>name</em>([<em>param</em>[, <em>param</em>[, ... <em>param</em>]]]) {
+ <em>statements</em>
+}
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>函式名稱。</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>傳遞至函式的參數名稱。</dd>
+</dl>
+
+<dl>
+ <dt><code>statements</code></dt>
+ <dd>組成該函式主體的陳述。</dd>
+</dl>
+
+<h3 id="回傳值">回傳值</h3>
+
+<p>{{jsxref("Global_Objects/AsyncFunction","AsyncFunction")}} 物件,代表著一個非同步函式,該函式會執行該函式內的程式碼。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>當 <code>async</code> 函式被呼叫時,它會回傳一個 {{jsxref("Promise")}}。如果該 <code>async</code> 函式回傳了一個值,<code>Promise</code> 的狀態將為一個帶有該回傳值的 resolved。如果 <code>async</code> 函式拋出例外或某個值,<code>Promise</code> 的狀態將為一個帶有被拋出值的 rejected。</p>
+
+<p>async 函式內部可以使用 {{jsxref("Operators/await", "await")}} 表達式,它會暫停此 async 函式的執行,並且等待傳遞至表達式的 Promise 的解析,解析完之後會回傳解析值,並繼續此 async 函式的執行。</p>
+
+<div class="note">
+<p><code>async/await</code> 函式的目的在於簡化同步操作 promise 的表現,以及對多個 <code>Promise</code> 物件執行某些操作。就像 <code>Promise 類似於具結構性的回呼函式,同樣地,async/await 好比將 generator 與 promise 組合起來。</code></p>
+</div>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="簡單範例">簡單範例</h3>
+
+<pre class="brush: js">function resolveAfter2Seconds(x) {
+ return new Promise(resolve =&gt; {
+ setTimeout(() =&gt; {
+ resolve(x);
+ }, 2000);
+ });
+}
+
+
+async function add1(x) {
+ const a = await resolveAfter2Seconds(20);
+ const b = await resolveAfter2Seconds(30);
+ return x + a + b;
+}
+
+add1(10).then(v =&gt; {
+ console.log(v); // prints 60 after 4 seconds.
+});
+
+
+async function add2(x) {
+ const p_a = resolveAfter2Seconds(20);
+ const p_b = resolveAfter2Seconds(30);
+ return x + await p_a + await p_b;
+}
+
+add2(10).then(v =&gt; {
+ console.log(v); // prints 60 after 2 seconds.
+});
+</pre>
+
+<div class="warning">
+<h4 id="不要誤解_Promise.all_的_await">不要誤解 <code>Promise.all</code> 的 <code>await</code></h4>
+
+<p>在 <code>add1</code> 裡,該執行為了第一個 <code>await</code> 而暫停了兩秒,接著為了第二個 <code>await</code> 又暫停了兩秒。在第一個計時器(timer)被觸發前,第二個計時器並不會被建立。而在 <code>add2</code> 裡,兩個計時器都被建立起來、也都執行 <code>await</code> 過了。這把它帶往了 resolve 所的 2 秒暫停、而不是 4 秒暫停。然而這兩個 <code>await</code> 呼叫都在連續運行,而非平行運行。<code>await</code> <strong>並不是</strong> <code>Promise.all</code> 的自動程式。如果你想讓兩個、甚至兩個以上的 <code>await</code> promises 同時執行(in parallel),你必須使用 <code>Promise.all</code>.</p>
+</div>
+
+<h3 id="使用_async_function_改寫_promise_鏈">使用 async function 改寫 promise 鏈</h3>
+
+<p>一個 API 呼叫所回傳的 {{jsxref("Promise")}} 會導致一個 promise 鏈,將函式分隔成多個部份。考慮下列的程式碼:</p>
+
+<pre class="brush: js">function getProcessedData(url) {
+ return downloadData(url) // returns a promise
+ .catch(e =&gt; {
+ return downloadFallbackData(url); // returns a promise
+ })
+ .then(v =&gt; {
+ return processDataInWorker(v); // returns a promise
+ });
+}
+</pre>
+
+<p>它可以用一個簡單的 <code>async function</code> 來改寫成這樣:</p>
+
+<pre class="brush: js">async function getProcessedData(url) {
+ let v;
+ try {
+ v = await downloadData(url);
+ } catch(e) {
+ v = await downloadFallbackData(url);
+ }
+ return processDataInWorker(v);
+}
+</pre>
+
+<p>注意上方的範例,在 return 陳述中沒有使用 await 陳述,這是因為 async function 的回傳值隱含地被包裝於 {{jsxref("Promise.resolve")}} 之中。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-definitions', 'async function')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Initial definition in ES2017.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.statements.async_function")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Operators/async_function", "async function expression")}}</li>
+ <li>{{jsxref("AsyncFunction")}} 物件</li>
+ <li>{{jsxref("Operators/await", "await")}}</li>
+ <li><a href="http://innolitics.com/10x/javascript-decorators-for-promise-returning-functions/">"Decorating Async Javascript Functions" on "innolitics.com"</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/block/index.html b/files/zh-tw/web/javascript/reference/statements/block/index.html
new file mode 100644
index 0000000000..62a09df015
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/block/index.html
@@ -0,0 +1,86 @@
+---
+title: 區塊
+slug: Web/JavaScript/Reference/Statements/block
+translation_of: Web/JavaScript/Reference/Statements/block
+---
+<p>{{jsSidebar("Statements")}}</p>
+
+<h2 id="總覽">總覽</h2>
+
+<p>區塊陳述用來組合零個或多個陳述。我們使用一對大括號 { } 以界定區塊。</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header" colspan="2">陳述句</td>
+ </tr>
+ <tr>
+ <td>Implemented in</td>
+ <td>JavaScript 1.0</td>
+ </tr>
+ <tr>
+ <td>ECMAScript edition</td>
+ <td>ECMA-262 1st edition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">{
+ <var>陳述_1</var>
+ <var>陳述_2</var>
+ ...
+ <var>陳述_n</var>
+}
+</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>陳述_1</code>, <code>陳述_2</code>, <code>陳述_n</code></dt>
+ <dd>區塊陳述中的陳述句群。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>區塊陳述通常配合流程控制陳述(如 <code>if</code>、<code>for</code>、<code>while</code>)一併使用。</p>
+
+<h4 id="var"><code>var</code></h4>
+
+<p>使用<code>var</code>區塊中定義的變數,其存取範圍是整個整個函式或是腳本,即為Execution Context的範圍中。</p>
+
+<pre class="brush: js">var x = 1;
+{
+ var x = 2;
+}
+alert(x); // outputs 2
+</pre>
+
+<p>輸出結果是 2。因為var是宣告於整個腳本範圍中。</p>
+
+<h4 id="let_和_const"><code>let </code>和 <code>const</code></h4>
+
+<p>當使用<code>let</code>或是<code>const</code>進行宣告時,其存取範圍是只有本身定義的區塊中。</p>
+
+<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">let</span> x <span class="operator token">=</span> <span class="number token">1</span><span class="punctuation token">;</span>
+<span class="punctuation token">{</span>
+ <span class="keyword token">let</span> x <span class="operator token">=</span> <span class="number token">2</span><span class="punctuation token">;</span>
+<span class="punctuation token">}</span>
+console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>x<span class="punctuation token">)</span><span class="punctuation token">;</span> <span class="comment token">// logs 1</span></code></pre>
+
+<h4 id="function"><code>function</code></h4>
+
+<p>當function被呼叫時,會建立此function的Execution Context,因此在function區塊使用<code>var</code>整個function區塊中都可對其進行存取。</p>
+
+<pre class="brush: js">function foo() {
+ {
+ var a = 'var';
+ {
+ let a = 'let';
+ console.log(a); // let
+ }
+ }
+ console.log(a); // var
+}
+foo();</pre>
diff --git a/files/zh-tw/web/javascript/reference/statements/break/index.html b/files/zh-tw/web/javascript/reference/statements/break/index.html
new file mode 100644
index 0000000000..ff72f9d25b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/break/index.html
@@ -0,0 +1,120 @@
+---
+title: break
+slug: Web/JavaScript/Reference/Statements/break
+tags:
+ - JavaScript
+ - Statement
+translation_of: Web/JavaScript/Reference/Statements/break
+---
+<p>{{jsSidebar("Statements")}}</p>
+
+<p><strong>break 陳述句</strong>會中斷目前的迭代、{{jsxref("Statements/switch", "switch")}} 或 {{jsxref("Statements/label", "label")}} 陳述句,並將程式流程轉到被中斷之陳述句後的陳述句。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-break.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>break [<em>label</em>];</code></pre>
+
+<dl>
+ <dt><code>label</code></dt>
+ <dd>可選的。欲中斷陳述句的標籤 (label) 識別。若不是要中斷迭代或 {{jsxref("Statements/switch", "switch")}},則需加此參數。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>中斷陳述 <code>break</code> 可加上標籤 (label) 參數,使其跳出被標籤的陳述語句。此中斷陳述 <code>break</code> 必須被包含在被標籤的陳述語句中。被標籤的陳述語句可被添加於任一個區塊 (<a class="internal" href="/en-US/docs/JavaScript/Reference/Statements/block" title="JavaScript/Reference/Statements/Block">block</a>) 前,而非限定在迴圈陳述。</p>
+
+<h2 id="範例">範例</h2>
+
+<p>下面函式包含一個中斷陳述 <code>break</code> ,當 <code>i</code> 值為 3 時,中斷 <code>while</code> 迴圈,並回傳 <code>3 * x</code> 。</p>
+
+<pre class="brush:js;highlight:[6];">function testBreak(x) {
+ var i = 0;
+
+ while (i &lt; 6) {
+ if (i == 3) {
+ break;
+ }
+ i += 1;
+ }
+
+ return i * x;
+}</pre>
+
+<p>The following code uses <code>break</code> statements with labeled blocks. A <code>break</code> statement must be nested within any label it references. Notice that <code>inner_block</code> is nested within <code>outer_block</code>.</p>
+
+<pre class="brush:js;highlight:[1,2,4];">outer_block: {
+ inner_block: {
+ console.log('1');
+ break outer_block; // breaks out of both inner_block and outer_block
+ console.log(':-('); // skipped
+ }
+ console.log('2'); // skipped
+}
+</pre>
+
+<p>The following code also uses <code>break</code> statements with labeled blocks but generates a Syntax Error because its <code>break</code> statement is within <code>block_1</code> but references <code>block_2</code>. A <code>break</code> statement must always be nested within any label it references.</p>
+
+<pre class="brush:js;highlight:[1,3,6];">block_1: {
+ console.log('1');
+ break block_2; // SyntaxError: label not found
+}
+
+block_2: {
+ console.log('2');
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Unlabeled version.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Labeled version added.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.8', 'Break statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-break-statement', 'Break statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-break-statement', 'Break statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.break")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Statements/continue", "continue")}}</li>
+ <li>{{jsxref("Statements/label", "label")}}</li>
+ <li>{{jsxref("Statements/switch", "switch")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/const/index.html b/files/zh-tw/web/javascript/reference/statements/const/index.html
new file mode 100644
index 0000000000..831a69155c
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/const/index.html
@@ -0,0 +1,129 @@
+---
+title: const
+slug: Web/JavaScript/Reference/Statements/const
+translation_of: Web/JavaScript/Reference/Statements/const
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<div>Constants (常數) 有點像使用 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/let">let</a></code> 所宣告的變數,具有區塊可視範圍。常數不能重複指定值,也不能重複宣告。</div>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-const.html")}}</div>
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">const <em>name1 = <em>value1 [</em>, <em>name2</em> = <em>value2</em><em> [</em>, ... [</em>, <em>nameN</em> = <em>valueN]]]</em>;</pre>
+
+<dl>
+ <dt><code>nameN</code></dt>
+ <dd>常數的名稱,可以是任何合法的 {{Glossary("identifier")}}。</dd>
+ <dt><code>valueN</code></dt>
+ <dd>常數的值,可以是任何合法的 <a href="/zh-TW/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions">expression</a>, 包括 function expression。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>上述宣告建立一個常數,它的可視範圍可能是全域的,或是在它所宣告的區域區塊中。 和 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/var">var</a></code> 變數不同的是,全域的常數不會變成 window 物件的屬性。常數必須要初始化;也就是說,你必須在宣告常數的同一個敘述式中指定這個常數的值。(這很合理,因為稍後就不能再變更常數的值了)</p>
+
+<p>宣告 <strong><code>const</code></strong> 會對於它的值建立一個唯讀的參考。並不是說這個值不可變更,而是這個變數不能再一次指定值。例如,假設常數的內容(值)是個物件,那麼此物件的內容(物件的參數)是可以更改的。</p>
+
+<p>所有關於 "<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone_and_errors_with_let">temporal dead zone</a>" 的狀況,都適用於 <code><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/let">let</a></code> and <code>const</code> 。</p>
+
+<p>在相同的可視範圍內,常數不能和函數,變數具有相同名稱。</p>
+
+<h2 id="範例">範例</h2>
+
+<p>以下範例展示常數的行為。請在你的瀏覽器中試試以下程式碼。</p>
+
+<pre class="brush:js">// 注意: 常數可以宣告成大寫或小寫,
+// 但習慣上使用全部大寫的字母。
+
+// 定義一個常數 MY_FAV 並賦予它的值為7
+const MY_FAV = 7;
+
+// 這裡會發生錯誤 - Uncaught TypeError: Assignment to constant variable.
+MY_FAV = 20;
+
+// MY_FAV 是 7
+console.log('我喜歡的數字是: ' + MY_FAV);
+
+// 嘗試重複宣告同名的常數,將會發生錯誤 - Uncaught SyntaxError: Identifier 'MY_FAV' has already been declared
+const MY_FAV = 20;
+
+// MY_FAV 這個名稱已經保留給上面的常數, 所以這裡也會錯誤。
+var MY_FAV = 20;
+
+// 這式子也會錯誤
+let MY_FAV = 20;
+
+// 很重要,請注意區塊可視範圍的特性。
+if (MY_FAV === 7) {
+ // 以下式子沒有問題,並且會建立一個名叫 MY_FAV 的具有區塊可視範圍的變數。
+ // (等同於使用 let 來宣告一個具有區塊可視範圍的非常數變數。)
+ let MY_FAV = 20;
+
+ // MY_FAV 現在變成 20
+ console.log('我喜歡的數字是:' + MY_FAV);
+
+ // 這會將變數懸掛於全域,而導致錯誤。(與常數同名)
+ var MY_FAV = 20;
+}
+
+// MY_FAV 仍然是 7
+console.log('我喜歡的數字是:' + MY_FAV);
+
+// 發生錯誤 - Uncaught SyntaxError: Missing initializer in const declaration
+const FOO;
+
+// 常數的值可以是一個物件
+const MY_OBJECT = {'key': 'value'};
+
+// 嘗試覆寫該物件將會發生錯誤 - Uncaught TypeError: Assignment to constant variable.
+MY_OBJECT = {'OTHER_KEY': 'value'};
+
+// 然而, 物件的屬性並沒有被保護,
+// 所以,以下敘述式沒有問題。
+MY_OBJECT.key = 'otherValue'; // Use Object.freeze() to make object immutable
+
+// 對陣列來說也是一樣
+const MY_ARRAY = [];
+// 可以把項目加到陣列中。
+MY_ARRAY.push('A'); // ["A"]
+// 然而,對這個變數指定新陣列,將會發生錯誤 - Uncaught TypeError: Assignment to constant variable.
+MY_ARRAY = ['B'];</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-let-and-const-declarations', 'Let and Const Declarations')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>初始化定義.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-let-and-const-declarations', 'Let and Const Declarations')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>沒有改變.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div class="hidden">本頁面中的相容性表格是從結構性資料產生. 如果您像要提供資料,請先查看 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 並寄給我們取得的請求。</div>
+
+<p>{{Compat("javascript.statements.const")}}</p>
+
+<h2 id="參閱">參閱</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/var"><code>var</code></a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/let"><code>let</code></a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#Constants">Constants in the JavaScript Guide</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/debugger/index.html b/files/zh-tw/web/javascript/reference/statements/debugger/index.html
new file mode 100644
index 0000000000..79a65a398e
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/debugger/index.html
@@ -0,0 +1,75 @@
+---
+title: debugger
+slug: Web/JavaScript/Reference/Statements/debugger
+translation_of: Web/JavaScript/Reference/Statements/debugger
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><strong>debugger 的宣告</strong>會執行可用的除錯功能,例如設定斷點。如果沒有可用的除錯功能,這個宣告沒有任何作用。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><code>debugger;</code></pre>
+
+<h2 id="示例">示例</h2>
+
+<p>以下示例示範了插入 debugger 宣告的程式碼,它會在函式被呼叫、而且有除錯器的時候執行除錯器。</p>
+
+<pre class="brush:js">function potentiallyBuggyCode() {
+ debugger;
+ // 執行並驗證一些潛在的問題、或是單步執行之類的。
+}</pre>
+
+<p>呼叫除錯器時,程式會在 debugger 宣告處暫停執行。它有點像是程式碼的斷點。</p>
+
+<p><a href="https://mdn.mozillademos.org/files/6963/Screen Shot 2014-02-07 at 9.14.35 AM.png"><img alt="Paused at a debugger statement." src="https://mdn.mozillademos.org/files/6963/Screen%20Shot%202014-02-07%20at%209.14.35%20AM.png" style="height: 371px; width: 700px;"></a></p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-debugger-statement', 'Debugger statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-debugger-statement', 'Debugger statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.15', 'Debugger statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>初期定義</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3', '#sec-7.5.3', 'Debugger statement')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-7.4.3', 'Debugger statement')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>只作為保留字而提到</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.debugger")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Debugging_JavaScript">JavaScript 除錯</a></li>
+ <li><a href="/zh-TW/docs/Tools/Debugger">Firefox 開發工具的的除錯器</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/export/index.html b/files/zh-tw/web/javascript/reference/statements/export/index.html
new file mode 100644
index 0000000000..195d4bed7f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/export/index.html
@@ -0,0 +1,165 @@
+---
+title: export
+slug: Web/JavaScript/Reference/Statements/export
+translation_of: Web/JavaScript/Reference/Statements/export
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><span class="seoSummary">用 <strong>export</strong> 可以指派函式、物件或變數,透過 {{jsxref("Statements/import", "import")}} 宣告給外部檔案引用。</span></p>
+
+<p>導出的模塊都會處於{{jsxref("Strict_mode","嚴謹模式")}},無論是否有所宣告。導出宣告無法使用嵌入式腳本(embedded script)。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">export { <var>name1</var>, <var>name2</var>, …, <var>nameN</var> };
+export { <var>variable1</var> as <var>name1</var>, <var>variable2</var> as <var>name2</var>, …, <var>nameN</var> };
+// 用 var, const 也通
+export let <var>name1</var>, <var>name2</var>, …, <var>nameN</var>;
+export let <var>name1</var> = …, <var>name2</var> = …, …, <var>nameN</var>;
+
+// 底下的 function 用 class, function* 也可以
+export default <em>expression</em>;
+export default function (…) { … }
+export default function name1(…) { … }
+
+export { <var>name1</var> as default, … };
+export * from …;
+export { <var>name1</var>, <var>name2</var>, …, <var>nameN</var> } from …;
+export { <var>import1</var> as <var>name1</var>, <var>import2</var> as <var>name2</var>, …, <var>nameN</var> } from …;</pre>
+
+<dl>
+ <dt><code>nameN</code></dt>
+ <dd>外部檔案使用 <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/import">import</a></code> 時,用於辨認的名稱。</dd>
+</dl>
+
+<h2 id="使用說明">使用說明</h2>
+
+<p>有兩種使用 export 的方式,<strong>named</strong> 與 <strong>default</strong>。每個模組中可以有多個 named exports, 但只能有一個 default export。每種 export 都對應到一個先前說的語法。</p>
+
+<ul>
+ <li>Named exports:
+ <pre class="brush: js">// 前面已經宣告的函式可以這樣輸出
+export { myFunction };
+
+// 輸出常數
+export const foo = Math.sqrt(2); </pre>
+ </li>
+ <li>預設 export (一個 js 檔案只能有一個):
+ <pre class="brush: js">export default function() {}
+// 或是 '<em>export default class {}</em>'
+// 結尾不用分號</pre>
+ </li>
+</ul>
+
+<p>Named exports 在輸出多個值的時候很有用,在 import 的時候, 會強制根據使用相同的物件名稱.</p>
+
+<p>但如果是 default export 則可以用任意的名字輸出.</p>
+
+<pre class="syntaxbox">export default k = 12; // 在test.js中這樣子寫
+
+import m from './test' // 注意這邊因為 export default 的關係, 可以用任意名字 import 原先的k出來
+
+console.log(m); // will log 12
+</pre>
+
+<p>以下語法並不會導出所有被引入的模塊:</p>
+
+<pre>export * from …;</pre>
+
+<p>你必須額外引入它的預設輸出,再導出之:</p>
+
+<pre>import mod from "mod";
+export default mod;</pre>
+
+<h2 id="使用範例">使用範例</h2>
+
+<h3 id="輸出命名過的變數">輸出命名過的變數</h3>
+
+<p>模塊內可以這樣用:</p>
+
+<pre class="brush: js">// module "my-module.js"
+function cube(x) {
+ return x * x * x;
+}
+const foo = Math.PI + Math.SQRT2;
+var graph = {
+ options:{
+ color:'white',
+ thickness:'2px'
+ },
+ draw: function(){
+ console.log('From graph draw function');
+ }
+}
+export { cube, foo, graph };
+</pre>
+
+<p>在另一個腳本就會變成這樣:</p>
+
+<pre class="brush: js">//You should use this script in html with the type module ,
+//eg ''&lt;script type="module" src="demo.js"&gt;&lt;/script&gt;",
+//open the page in a httpserver,otherwise there will be a CORS policy error.
+//script demo.js
+
+import { cube, foo, graph } from 'my-module';
+graph.options = {
+ color:'blue',
+ thickness:'3px'
+};
+graph.draw();
+console.log(cube(3)); // 27
+console.log(foo); // 4.555806215962888</pre>
+
+<h3 id="使用預設輸出">使用預設輸出</h3>
+
+<p>如果我們要輸出單獨的函式、物件、class 或當做 fallback 值來輸出的話,就可以用預設輸出:</p>
+
+<pre class="brush: js">// module "my-module.js"
+export default function cube(x) {
+ return x * x * x;
+}
+</pre>
+
+<p>外部檔案的 import 用法:</p>
+
+<pre class="brush: js">import cube from 'my-module';
+console.log(cube(3)); // 27
+</pre>
+
+<p>Note 注意預設輸出不能使用 var, let , const。</p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-exports', 'Exports')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>初始定義。</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-exports', 'Exports')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.export")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Statements/import", "import")}}</li>
+ <li><a href="https://hacks.mozilla.org/2015/08/es6-in-depth-modules/">ES6 in Depth: Modules</a>, Hacks blog post by Jason Orendorff</li>
+ <li><a href="http://exploringjs.com/es6/ch_modules.html">Axel Rauschmayer's book: "Exploring JS: Modules"</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/for...in/index.html b/files/zh-tw/web/javascript/reference/statements/for...in/index.html
new file mode 100644
index 0000000000..8877c28d79
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/for...in/index.html
@@ -0,0 +1,116 @@
+---
+title: for...in
+slug: Web/JavaScript/Reference/Statements/for...in
+translation_of: Web/JavaScript/Reference/Statements/for...in
+---
+<p>{{jsSidebar("Statements")}}</p>
+
+<h2 id="Summary" name="Summary">Summary</h2>
+
+<p>迭代物件的可列舉屬性。對每個相異屬性,執行陳述式。</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th colspan="2">Statement</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Implemented in:</td>
+ <td>JavaScript 1.0</td>
+ </tr>
+ <tr>
+ <td>ECMA Version:</td>
+ <td>ECMA-262</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Syntax" name="Syntax">語法</h2>
+
+<pre class="syntaxbox">for (<var>變數</var> in <var>物件</var>) {<em>...</em>
+}</pre>
+
+<h3 id="Parameters" name="Parameters">參數</h3>
+
+<dl>
+ <dt><code>變數</code></dt>
+ <dd>A different property name is assigned to <em>variable</em> on each iteration.</dd>
+ <dt><code>物件</code></dt>
+ <dd>Object whose enumerable properties are iterated.</dd>
+</dl>
+
+<h2 id="Description" name="Description">Description</h2>
+
+<p><code>for...in</code> 迴圈只迭代可列舉屬性。由內建建構式(如:Array、Object) 製造的物件,從 <code>Object.prototype</code> 和 <code>String.prototype</code> 繼承了不可列舉屬性,如: <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String">String</a></code>的<code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf">indexOf</a></code> 方法,或 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object">Object</a></code>的 <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString">toString</a></code> 方法。 迴圈將迭代全部可列舉屬性,包括了物件自身的和物件繼承自它的建構式之原型的可列舉屬性。(原型鏈上較接近物件的屬性覆蓋原型的屬性)</p>
+
+<p>A <code>for...in</code> loop iterates over the properties of an object in an arbitrary order (see the <a href="/en-US/docs/JavaScript/Reference/Operators/delete#Cross-browser_issues">delete operator</a> for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). If a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. A property that is deleted before it has been visited will not be visited later. Properties added to the object over which iteration is occurring may either be visited or omitted from iteration. In general it is best not to add, modify or remove properties from the object during iteration, other than the property currently being visited. There is no guarantee whether or not an added property will be visited, whether a modified property (other than the current one) will be visited before or after it is modified, or whether a deleted property will be visited before it is deleted.</p>
+
+<div class="note" id="hasOwnPropertyNote">
+<p>If you only want to consider properties attached to the object itself, and not its prototypes, use <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames">getOwnPropertyNames</a> or perform a <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty">hasOwnProperty</a> check (<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable">propertyIsEnumerable</a> can also be used). Alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method.</p>
+</div>
+
+<div class="note" id="arrayNote">
+<p><strong><code>for..in</code> 不應該用來迭代一個索引順序很重要的<a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array">陣列</a>。</strong> 陣列索引只是以整數命名的可列舉屬性,其他方面等同於一般物件屬性。 無法擔保 <code>for...in</code> 以特定順序傳回索引,並且它將傳回全部可列舉屬性,包括非整數名的,以及繼承而來的可列舉屬性。</p>
+
+<p>因為迭代的順序依賴於 JavaScript 引擎的實作,在不同引擎下,迭代一個陣列可能不是以一個一致的順序存取陣列元素。因此,當你迭代陣列,且該陣列的存取順序很重要時,最好是使用以數值索引的 <a href="/en-US/docs/JavaScript/Reference/Statements/for">for</a> 迴圈 (或 <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach">Array.forEach</a> 或非標準 <code><a href="/en-US/docs/JavaScript/Reference/Statements/for...of">for...of</a></code> 迴圈)。</p>
+</div>
+
+<h2 id="Example" name="Example">Examples</h2>
+
+<p>The following function takes as its arguments an object and the object's name. It then iterates over all the object's enumerable properties and returns a string of the property names and their values.</p>
+
+<pre class="brush: js">var o = {a:1, b:2, c:3};
+
+function show_props(obj, objName) {
+ var result = "";
+
+ for (var prop in obj) {
+ result += objName + "." + prop + " = " + obj[prop] + "\n";
+ }
+
+ return result;
+}
+
+alert(show_props(o, "o")); /* alerts (in different lines): o.a = 1 o.b = 2 o.c = 3 */
+</pre>
+
+<p>The following function illustrates the use of hasOwnProperty: the inherited properties are not displayed.</p>
+
+<pre class="brush: js">var triangle = {a:1, b:2, c:3};
+
+function ColoredTriangle() {
+ this.color = "red";
+}
+
+ColoredTriangle.prototype = triangle;
+
+function show_own_props(obj, objName) {
+ var result = "";
+
+ for (var prop in obj) {
+ if( obj.hasOwnProperty( prop ) ) {
+ result += objName + "." + prop + " = " + obj[prop] + "\n";
+ }
+ }
+
+ return result;
+}
+
+o = new ColoredTriangle();
+alert(show_own_props(o, "o")); /* alerts: o.color = red */
+</pre>
+
+<h2 id="See_also" name="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/JavaScript/Reference/Statements/for...of"><code>for...of</code></a> - a similar statement that iterates over the property <em>values</em></li>
+ <li><a href="/en-US/docs/JavaScript/Reference/Statements/for_each...in"><code>for each...in</code></a> - a similar statement, but iterates over the values of object's properties, rather than the property names themselves (<a href="/en-US/docs/JavaScript/New_in_JavaScript/1.6">New in JavaScript 1.6</a> but deprecated)</li>
+ <li><a href="/en-US/docs/JavaScript/Reference/Statements/for">for</a></li>
+ <li><a href="/en-US/docs/JavaScript/Guide/Iterators_and_Generators">Generator expressions</a> (uses the <code>for...in</code> syntax)</li>
+ <li><a href="/en-US/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li>
+ <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames"><code>getOwnPropertyNames</code></a></li>
+ <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty"><code>hasOwnProperty</code></a></li>
+ <li><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach"><code>Array.prototype.forEach</code></a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/function_star_/index.html b/files/zh-tw/web/javascript/reference/statements/function_star_/index.html
new file mode 100644
index 0000000000..11b1013537
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/function_star_/index.html
@@ -0,0 +1,207 @@
+---
+title: function*
+slug: Web/JavaScript/Reference/Statements/function*
+tags:
+ - ECMAScript 2015
+ - Function
+ - Iterator
+ - JavaScript
+ - Statement
+translation_of: Web/JavaScript/Reference/Statements/function*
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><code><strong>function*</strong></code> 宣告式(<code>function</code> 關鍵字後面跟著一個星號)定義了一個<em>生成器函式(generator function)</em>,他會回傳一個{{jsxref("Global_Objects/Generator","生成器(Generator)")}}物件。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-functionasterisk.html")}}</div>
+
+
+
+<div class="noinclude">
+<p>你可以透過 {{jsxref("GeneratorFunction")}} 建構式來定義生成器函式。</p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">function* <em>name</em>([<em>param</em>[, <em>param</em>[, ... <em>param</em>]]]) {
+ <em>statements</em>
+}
+</pre>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>函式名稱。</dd>
+</dl>
+
+<dl>
+ <dt><code>param</code></dt>
+ <dd>要被傳入函式的引數名稱,一個函式最多可以擁有 255 個引數。</dd>
+</dl>
+
+<dl>
+ <dt><code>statements</code></dt>
+ <dd>statements 構成了函式內容的陳述式。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>生成器是可以離開後再次進入的函式。在兩次進入之間,生成器的執行狀態(變數綁定狀態)會被儲存。</p>
+
+<p>呼叫生成器函式並不會讓裡面的程式碼立即執行,而是會回傳一個針對該函式的<a href="/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols#iterator">迭代器(iterator)</a>物件。當呼叫迭代器的 <code>next()</code> 方法時,生成器函式將會執行到遭遇的第一個 {{jsxref("Operators/yield", "yield")}} 運算式,該運算式給定的值將從迭代器中回傳,如果是 {{jsxref("Operators/yield*", "yield*")}} 則會交給另一個生成器函式處理。<code>next()</code> 方法回傳一個物件,該物件有 <code>value</code> 屬性,包含了產生的數值,還有 <code>done</code> 屬性,為布林值,指出該生成器是否產出最後的數值。呼叫 <code>next()</code> 方法如果帶有一個參數,將會讓先前暫停的生成器函式恢復執行,以該參數值取代先前暫停的 <code>yield</code> 陳述式。</p>
+
+<p>生成器中的 <code>return</code> 陳述式被執行時,會讓生成器 <code>done</code> 狀態為真。若有數值被返回的動作帶回,將是放在 <code>value</code> 傳回的。已返回的生成器不會再產生任何數值。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="簡單例子">簡單例子</h3>
+
+<pre class="brush: js">function* idMaker() {
+ var index = 0;
+ while (index &lt; index+1)
+ yield index++;
+}
+
+var gen = idMaker();
+
+console.log(gen.next().value); // 0
+console.log(gen.next().value); // 1
+console.log(gen.next().value); // 2
+console.log(gen.next().value); // 3
+// ...</pre>
+
+<h3 id="yield*_的範例">yield* 的範例</h3>
+
+<pre class="brush: js">function* anotherGenerator(i) {
+ yield i + 1;
+ yield i + 2;
+ yield i + 3;
+}
+
+function* generator(i) {
+ yield i;
+ yield* anotherGenerator(i);
+ yield i + 10;
+}
+
+var gen = generator(10);
+
+console.log(gen.next().value); // 10
+console.log(gen.next().value); // 11
+console.log(gen.next().value); // 12
+console.log(gen.next().value); // 13
+console.log(gen.next().value); // 20
+</pre>
+
+<h3 id="傳入引數至生成器">傳入引數至生成器</h3>
+
+<pre class="brush: js">function* logGenerator() {
+ console.log(0);
+ console.log(1, yield);
+ console.log(2, yield);
+ console.log(3, yield);
+}
+
+var gen = logGenerator();
+
+// the first call of next executes from the start of the function
+// until the first yield statement
+gen.next(); // 0
+gen.next('pretzel'); // 1 pretzel
+gen.next('california'); // 2 california
+gen.next('mayonnaise'); // 3 mayonnaise
+</pre>
+
+<h3 id="生成器中的回傳陳述式">生成器中的回傳陳述式</h3>
+
+<pre class="brush: js">function* yieldAndReturn() {
+ yield "Y";
+ return "R";
+ yield "unreachable";
+}
+
+var gen = yieldAndReturn()
+console.log(gen.next()); // { value: "Y", done: false }
+console.log(gen.next()); // { value: "R", done: true }
+console.log(gen.next()); // { value: undefined, done: true }
+</pre>
+
+<h3 id="生成器無法被建構">生成器無法被建構</h3>
+
+<pre class="brush: js example-bad">function* f() {}
+var obj = new f; // throws "TypeError: f is not a constructor"</pre>
+
+<h3 id="以表達式定義生成器">以表達式定義生成器</h3>
+
+<pre><code>const foo = function* () { yield 10; yield 20; };
+const bar = foo();console.log(bar.next()); // {value: 10, done: false}</code></pre>
+
+<p> </p>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ES2015', '#', 'function*')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2016', '#', 'function*')}}</td>
+ <td>{{Spec2('ES2016')}}</td>
+ <td>Changed that generators should not have [[Construct]] trap and will throw when used with <code>new</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#', 'function*')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.statements.generator_function")}}</p>
+</div>
+
+<h2 id="Firefox_規範註記">Firefox 規範註記</h2>
+
+<h4 id="Generators_and_iterators_in_Firefox_versions_before_26">Generators and iterators in Firefox versions before 26</h4>
+
+<p>Older Firefox versions implement an older version of the generators proposal. In the older version, generators were defined using a regular <code>function</code> keyword (without an asterisk) among other differences. See <a href="/en-US/docs/Web/JavaScript/Reference/Statements/Legacy_generator_function">Legacy generator function </a>for further information.</p>
+
+<h4 id="IteratorResult_object_returned_instead_of_throwing"><code>IteratorResult</code> object returned instead of throwing</h4>
+
+<p>Starting with Gecko 29 {{geckoRelease(29)}}, the completed generator function no longer throws a {{jsxref("TypeError")}} "generator has already finished". Instead, it returns an <code>IteratorResult</code> object like <code>{ value: undefined, done: true }</code> ({{bug(958951)}}).</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Operators/function*", "function* expression")}}</li>
+ <li>{{jsxref("GeneratorFunction")}} object</li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Iteration_protocols">迭代協議</a></li>
+ <li>{{jsxref("Operators/yield", "yield")}}</li>
+ <li>{{jsxref("Operators/yield*", "yield*")}}</li>
+ <li>{{jsxref("Function")}} object</li>
+ <li>{{jsxref("Statements/function", "function declaration")}}</li>
+ <li>{{jsxref("Operators/function", "function expression")}}</li>
+ <li>{{jsxref("Functions_and_function_scope", "Functions and function scope")}}</li>
+ <li>Other web resources:
+ <ul>
+ <li><a href="http://facebook.github.io/regenerator/">Regenerator</a> an ES2015 generator compiler to ES5</li>
+ <li><a href="http://www.youtube.com/watch?v=qbKWsbJ76-s">Forbes Lindesay: Promises and Generators: control flow utopia -- JSConf EU 2013</a></li>
+ <li><a href="https://github.com/mozilla/task.js">Task.js</a></li>
+ <li><a href="https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch4.md#iterating-generators-asynchronously">Iterating generators asynchronously</a></li>
+ </ul>
+ </li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/if...else/index.html b/files/zh-tw/web/javascript/reference/statements/if...else/index.html
new file mode 100644
index 0000000000..a9317aa8a6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/if...else/index.html
@@ -0,0 +1,169 @@
+---
+title: if...else
+slug: Web/JavaScript/Reference/Statements/if...else
+translation_of: Web/JavaScript/Reference/Statements/if...else
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p>當條件成立的時候會執行 if 陳述式裡的程式,而不成立時則執行另外一個陳述式。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-ifelse.html")}}</div>
+
+<p class="hidden">這個互動式的源碼被放在 GitHub 的 Repository 裡,如果您想對此互動式範例專案提出貢獻的話,請 clone https://github.com/mdn/interactive-examples 並送出 pull request。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">if (<em>條件式</em>)
+ <em>statement1</em>
+[else
+ <em>statement2</em>]
+</pre>
+
+<dl>
+ <dt><code>條件式</code></dt>
+ <dd>一個成立或不成立的<a href="/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions">運算式</a>。</dd>
+</dl>
+
+<dl>
+ <dt><code>第一個陳述式(statement1)</code></dt>
+ <dd>如果if中的條件(conditions)為真時執行陳述式(statements)。陳述式可以為任何內容,包含巢狀式(nested)的if陳述。當要執行多行的陳述式(statements)時,使用區塊(block)將所要執行的陳述式包覆。如果不需要執行任何動作時,則不撰寫任何陳述式(empty statement)。</dd>
+ <dt><code>第二個陳述式(statement2)</code></dt>
+</dl>
+
+<dl>
+ <dd>當件不成立時所執行的部份,當else被撰寫時才會被執行。可以是任何的陳述式,包含使用區塊(block)及巢狀(nested)的陳述。</dd>
+ <dd></dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>多重的 <code>if...else</code> 陳述式可以使用 <code>else if</code> 子句來建立一個巢狀結構的句子。要記住,在JavaScript中沒有 <code>elseif</code> (一個單字) 的語法可以用。</p>
+
+<pre class="eval notranslate">if (<em>condition1</em>)
+ <em>statement1</em>
+else if (<em>condition2</em>)
+ <em>statement2</em>
+else if (<em>condition3</em>)
+ <em>statement3</em>
+...
+else
+ <em>statementN</em>
+</pre>
+
+<p>將巢狀結構適當的排版後,我們能更了解其背後運作的邏輯:</p>
+
+<pre class="eval notranslate">if (<em>condition1</em>)
+ <em>statement1</em>
+else
+ if (<em>condition2</em>)
+ <em>statement2</em>
+ else
+ if (<em>condition3</em>)
+...
+</pre>
+
+<p>如果在一個條件式中有多個陳述要執行,可以使用區塊陳述式(<code>{ ... }</code>) 把所有陳述包在一起。 通常來說,無論如何都使用區塊陳述式是個很好的習慣,尤其是當你使用巢狀結構的 <code>if</code> 陳述式時,這會讓人更容易理解你的程式碼。</p>
+
+<pre class="eval notranslate">if (<em>condition</em>) {
+ <em>statements1</em>
+} else {
+ <em>statements2</em>
+}
+</pre>
+
+<p>不要被<a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean" title="en/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>物件中,布林值的 <code>true</code> 和 <code>false</code> 給混淆了。任何值只要不是 <code>false</code>、 <code>undefined</code>、 <code>null</code>、 <code>0</code>、 <code>NaN</code>,或者空字串 (<code>""</code>),並且任何物件,包括其值是 <code>false</code>的布林物件 ,仍然會被條件陳述式視為條件成立。舉例而言:</p>
+
+<pre class="brush: js notranslate">var b = new Boolean(false);
+if (b) // this condition is truthy
+</pre>
+
+<h2 id="實例">實例</h2>
+
+<h3 id="使用_if...else">使用 <code>if...else</code></h3>
+
+<pre class="brush: js notranslate">if (cipher_char === from_char) {
+ result = result + to_char;
+ x++;
+} else {
+ result = result + clear_char;
+}
+</pre>
+
+<h3 id="使用_else_if">使用 <code>else if</code></h3>
+
+<p>要記得JavaScript沒有 <code>elseif</code> 可以使用。不過,你可以使用 <code>else</code> 和 <code>if</code>中間夾著空白的語法:</p>
+
+<pre class="brush: js notranslate">if (x &gt; 5) {
+ /* do the right thing */
+} else if (x &gt; 50) {
+ /* do the right thing */
+} else {
+ /* do the right thing */
+}</pre>
+
+<h3 id="條件表達式中的賦值">條件表達式中的賦值</h3>
+
+<p>建議不要在條件表達式中直接對物件賦值,因為這會使人在瀏覽程式碼時很容易將賦值( assignment )與相等( equality )混淆。舉例而言,不要使用以下寫法:</p>
+
+<pre class="brush: js example-bad notranslate">if (x = y) {
+ /* do the right thing */
+}
+</pre>
+
+<p>如果你必須在條件表達式中使用賦值,最好ˇ的作法是以額外的括號包住賦值語句,如下所示:</p>
+
+<pre class="brush: js example-good notranslate">if ((x = y)) {
+ /* do the right thing */
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-if-statement', 'if statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-if-statement', 'if statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.5', 'if statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3', '#sec-12.5', 'if statement')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-12.5', 'if statement')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.if_else")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Statements/block", "block")}}</li>
+ <li>{{jsxref("Statements/switch", "switch")}}</li>
+ <li>{{jsxref("Operators/conditional_operator", "conditional operator")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/import/index.html b/files/zh-tw/web/javascript/reference/statements/import/index.html
new file mode 100644
index 0000000000..7b3ef2402b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/import/index.html
@@ -0,0 +1,203 @@
+---
+title: import
+slug: Web/JavaScript/Reference/Statements/import
+translation_of: Web/JavaScript/Reference/Statements/import
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><span class="seoSummary"><strong>import</strong> 宣告用於引入由另一個模塊所導出的綁定。</span>被引入的模塊,無論是否宣告{{jsxref("Strict_mode","strict mode","嚴謹模式")}},都會處於該模式。<code>import</code> 宣告無法用於嵌入式腳本(embedded scripts)。</p>
+
+<p>There is also a function-like dynamic <code><strong>import()</strong></code>, which does not require scripts of <code>type="module"</code>.</p>
+
+<p>Dynamic import is useful in situations where you wish to load a module conditionally, or on demand. The static form is preferable for loading initial dependencies, and can benefit more readily from static analysis tools and <a href="/en-US/docs/Glossary/Tree_shaking">tree shaking</a>.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">import <em>defaultExport</em> from "<em>module-name</em>";
+import * as <em>name</em> from "<em>module-name</em>";
+import { <em>export </em>} from "<em>module-name</em>";
+import { <em>export</em> as <em>alias </em>} from "<em>module-name</em>";
+import { <em>export1 , export2</em> } from "<em>module-name</em>";
+import { <em>export1 , export2</em> as <em>alias2</em> , <em>[...]</em> } from "<em>module-name</em>";
+import <em>defaultExport</em>, { <em>export</em> [ , <em>[...]</em> ] } from "<em>module-name</em>";
+import <em>defaultExport</em>, * as <em>name</em> from "<em>module-name</em>";
+import "<em>module-name</em>";</pre>
+
+<dl>
+ <dt><code>defaultExport</code></dt>
+ <dd>從模塊要參照過去的預設導出名。</dd>
+ <dt><code>module-name</code></dt>
+ <dd>要導入的模塊名。通常包含 <code>.js </code> 模塊文件的相對或絕對路徑名。請確認你的開發環境,某些bundler 會允許或要求你加入副檔名。只允許使用單引號和雙引號字符串。</dd>
+ <dt><code>name</code></dt>
+ <dd>參照導入時,會用做 namespace 種類的模塊名。</dd>
+ <dt><code>export, exportN</code></dt>
+ <dd>導出要被引入時,要用的名號。</dd>
+ <dt><code>alias, aliasN</code></dt>
+ <dd>別名,重新命名被import進來的js稱呼。</dd>
+</dl>
+
+<h2 id="敘述">敘述</h2>
+
+<p><code>name</code> 參數能將模塊物件(module object)名用於 namespace 種類,以便各導出能參照之。<code>export</code> 參數會在引用 <code>import * as name</code> 語法時,指定 individual named export。以下示例將展示語法的簡例。</p>
+
+<h3 id="引入整個模塊的內容">引入整個模塊的內容</h3>
+
+<p>本例在當前作用域插入了 <code>myModule</code> 變數,並把所有來自 <code>/modules/my-module.js</code> 檔案的模塊導出。</p>
+
+<pre class="brush: js">import * as <em>myModule</em> from '/modules/my-module.js';
+</pre>
+
+<p>這裡會用到指定的模塊名(在此為 myModule)訪問導出來的命名空間。例如說引入模塊有 <code>doAllTheAmazingThings()</code> 的話,就可以這麼寫:</p>
+
+<pre class="brush: js">myModule.doAllTheAmazingThings();</pre>
+
+<h3 id="從模塊引入單一導出">從模塊引入單一導出</h3>
+
+<p>給定由 <code>my-module</code> 導出的模塊,稱作 <code>myExport</code> 物件與數值,無論是顯性(因為整個模塊被導出了)與隱性(使用 {{jsxref("Statements/export", "export")}} 宣告),這裡就在當前的作用域插入 <code>myExport</code>。</p>
+
+<pre class="brush: js">import {myExport} from '/modules/my-module.js';</pre>
+
+<h3 id="從模塊引入數個導出">從模塊引入數個導出</h3>
+
+<p>例在當前作用域插入了 <code>foo</code> 與 <code>bar</code>。</p>
+
+<pre class="brush: js">import {foo, bar} from '/modules/my-module.js';</pre>
+
+<h3 id="使用便利的_alias_引入或導出">使用便利的 alias 引入或導出</h3>
+
+<p>在引入時,可以重新命名導出的模塊。例如說,這裡就就在目前作用域插入 <code>shortName</code> 變數。</p>
+
+<pre class="brush: js">import {reallyReallyLongModuleExportName as shortName}
+ from '/modules/my-module.js';</pre>
+
+<h3 id="引入時重命名數個導出">引入時重命名數個導出</h3>
+
+<p>使用別名(aliases)以便引入或導出模塊</p>
+
+<pre class="brush: js">import {
+ reallyReallyLongModuleExportName as shortName,
+ anotherLongModuleName as short
+} from '/modules/my-module.js';</pre>
+
+<h3 id="僅作為副作用引入模塊">僅作為副作用引入模塊</h3>
+
+<p>僅作為副作用(side effect)引入整個模塊,而不直接引入任何東西。這樣會在不引入實際數值的情況下,執行整個模塊的程式。</p>
+
+<pre class="brush: js">import '/modules/my-module.js';
+</pre>
+
+<h3 id="引入預設">引入預設</h3>
+
+<p>你可以引入預設好的 {{jsxref("Statements/export", "export")}},無論他屬於物件、函式、還是類別。<code>import</code> 宣告可以接著引入該預設。</p>
+
+<p>最簡單的預設引入:</p>
+
+<pre class="brush: js">import myDefault from '/modules/my-module.js';</pre>
+
+<p>It is also possible to use the default syntax with the ones seen above (namespace imports or named imports). In such cases, the default import will have to be declared first. For instance:</p>
+
+<pre class="brush: js">import myDefault, * as myModule from '/modules/my-module.js';
+// myModule used as a namespace</pre>
+
+<p>或是:</p>
+
+<pre class="brush: js">import myDefault, {foo, bar} from '/modules/my-module.js';
+// specific, named imports
+</pre>
+
+<h3 id="動態引入">動態引入</h3>
+
+<p><code>import</code> 關鍵字也能透過函式呼叫引入之。在這種情況下,該函式回傳 promise。</p>
+
+<pre class="brush: js">import('/modules/my-module.js')
+ .then((module) =&gt; {
+ // 在模塊內作點事情
+ });
+</pre>
+
+<p>這方法也支援關鍵字 await。</p>
+
+<pre class="brush: js">let module = await import('/modules/my-module.js');</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>引用次要模塊以協助程式執行 AJAX JSON 請求。</p>
+
+<h3 id="模塊:file.js">模塊:file.js</h3>
+
+<pre class="brush: js">function getJSON(url, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.onload = function () {
+ callback(this.responseText)
+ };
+ xhr.open('GET', url, true);
+ xhr.send();
+}
+
+export function getUsefulContents(url, callback) {
+ getJSON(url, data =&gt; callback(JSON.parse(data)));
+}</pre>
+
+<h3 id="主要程式:main.js">主要程式:main.js</h3>
+
+<pre class="brush: js">import { getUsefulContents } from '/modules/file.js';
+
+getUsefulContents('http://www.example.com',
+ data =&gt; { doSomethingUseful(data); });</pre>
+
+<h3 id="動態引入_2">動態引入</h3>
+
+<p>This example shows how to load functionality on to a page based on a user action, in this case a button click, and then call a function within that module. This is not the only way to implement this functionality. The <code>import()</code> function also supports <code>await</code>.</p>
+
+<pre class="brush: js">const main = document.querySelector("main");
+for (const link of document.querySelectorAll("nav &gt; a")) {
+ link.addEventListener("click", e =&gt; {
+ e.preventDefault();
+
+ import('/modules/my-module.js')
+ .then(module =&gt; {
+ module.loadPageInto(main);
+ })
+ .catch(err =&gt; {
+ main.textContent = err.message;
+ });
+ });
+}</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-imports', 'Imports')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-imports', 'Imports')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.import")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("Statements/export", "export")}}</li>
+ <li><a href="https://blogs.windows.com/msedgedev/2016/05/17/es6-modules-and-beyond/">Previewing ES6 Modules and more from ES2015, ES2016 and beyond</a></li>
+ <li><a href="https://hacks.mozilla.org/2015/08/es6-in-depth-modules/">ES6 in Depth: Modules</a>, Hacks blog post by Jason Orendorff</li>
+ <li><a href="https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/">ES modules: A cartoon deep-dive</a>, Hacks blog post by Lin Clark</li>
+ <li><a class="external" href="http://exploringjs.com/es6/ch_modules.html">Axel Rauschmayer's book: "Exploring JS: Modules"</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/index.html b/files/zh-tw/web/javascript/reference/statements/index.html
new file mode 100644
index 0000000000..63c3483f1b
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/index.html
@@ -0,0 +1,147 @@
+---
+title: 陳述式與宣告
+slug: Web/JavaScript/Reference/Statements
+tags:
+ - JavaScript
+ - Reference
+ - statements
+translation_of: Web/JavaScript/Reference/Statements
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p>JavaScript 應用程式由適當的陳述式組成。一個單一的陳述式可以跨用好幾行。 多個陳述式也可以藉由分號分隔來寫在同一行。 這不是一個關鍵字,而是一群關鍵字。</p>
+
+<h2 id="陳述式與宣告分類">陳述式與宣告分類</h2>
+
+<p>For an alphabetical listing see the sidebar on the left.</p>
+
+<h3 id="流程控制">流程控制</h3>
+
+<dl>
+ <dt>{{jsxref("Statements/block", "Block")}}</dt>
+ <dd>A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets.</dd>
+ <dt>{{jsxref("Statements/break", "break")}}</dt>
+ <dd>中斷當下的迴圈、條件判斷(switch)或是標籤(label)陳述式,並將程式流程轉到被中斷陳述式後的陳述式。</dd>
+ <dt>{{jsxref("Statements/continue", "continue")}}</dt>
+ <dd>Terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration.</dd>
+ <dt>{{jsxref("Statements/Empty", "Empty")}}</dt>
+ <dd>An empty statement is used to provide no statement, although the JavaScript syntax would expect one.</dd>
+ <dt>{{jsxref("Statements/if...else", "if...else")}}</dt>
+ <dd>當特定的條件為真時執行一段陳述式,若為假則另一段陳述式就會被執行。</dd>
+ <dt>{{jsxref("Statements/switch", "switch")}}</dt>
+ <dd>Evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.</dd>
+ <dt>{{jsxref("Statements/throw", "throw")}}</dt>
+ <dd>Throws a user-defined exception.</dd>
+ <dt>{{jsxref("Statements/try...catch", "try...catch")}}</dt>
+ <dd>Marks a block of statements to try, and specifies a response, should an exception be thrown.</dd>
+</dl>
+
+<h3 id="宣告">宣告</h3>
+
+<dl>
+ <dt>{{jsxref("Statements/var", "var")}}</dt>
+ <dd>Declares a variable, optionally initializing it to a value.</dd>
+ <dt>{{jsxref("Statements/let", "let")}}</dt>
+ <dd>Declares a block scope local variable, optionally initializing it to a value.</dd>
+ <dt>{{jsxref("Statements/const", "const")}}</dt>
+ <dd>Declares a read-only named constant.</dd>
+</dl>
+
+<h3 id="函數與類別(Class)">函數與類別(Class)</h3>
+
+<dl>
+ <dt>{{jsxref("Statements/function", "function")}}</dt>
+ <dd>用指定的變數宣告一個函數</dd>
+ <dt>{{jsxref("Statements/function*", "function*")}}</dt>
+ <dd>Generators functions enable writing <a href="/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol">iterators</a> more easily.</dd>
+ <dt>{{jsxref("Statements/async_function", "async function")}}</dt>
+ <dd>Declares an async function with the specified parameters.</dd>
+ <dt>{{jsxref("Statements/return", "return")}}</dt>
+ <dd>Specifies the value to be returned by a function.</dd>
+ <dt>{{jsxref("Statements/class", "class")}}</dt>
+ <dd>Declares a class.</dd>
+</dl>
+
+<h3 id="迭代(Iteration)">迭代(Iteration)</h3>
+
+<dl>
+ <dt>{{jsxref("Statements/do...while", "do...while")}}</dt>
+ <dd>Creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.</dd>
+ <dt>{{jsxref("Statements/for", "for")}}</dt>
+ <dd>Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.</dd>
+ <dt>{{deprecated_inline}} {{non-standard_inline()}} {{jsxref("Statements/for_each...in", "for each...in")}}</dt>
+ <dd>Iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed.</dd>
+ <dt>{{jsxref("Statements/for...in", "for...in")}}</dt>
+ <dd>Iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.</dd>
+ <dt>{{jsxref("Statements/for...of", "for...of")}}</dt>
+ <dd>Iterates over iterable objects (including {{jsxref("Global_Objects/Array","arrays","","true")}}, array-like objects, <a href="/en-US/docs/JavaScript/Guide/Iterators_and_Generators">iterators and generators</a>), invoking a custom iteration hook with statements to be executed for the value of each distinct property.</dd>
+ <dt>{{jsxref("Statements/while", "while")}}</dt>
+ <dd>Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.</dd>
+</dl>
+
+<h3 id="其他">其他</h3>
+
+<dl>
+ <dt>{{jsxref("Statements/debugger", "debugger")}}</dt>
+ <dd>Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.</dd>
+ <dt>{{jsxref("Statements/export", "export")}}</dt>
+ <dd>Used to export functions to make them available for imports in external modules, another scripts.</dd>
+ <dt>{{jsxref("Statements/import", "import")}}</dt>
+ <dd>Used to import functions exported from an external module, another script.</dd>
+ <dt>{{jsxref("Statements/label", "label")}}</dt>
+ <dd>Provides a statement with an identifier that you can refer to using a <code>break</code> or <code>continue</code> statement.</dd>
+</dl>
+
+<dl>
+ <dt>{{deprecated_inline}} {{jsxref("Statements/with", "with")}}</dt>
+ <dd>Extends the scope chain for a statement.</dd>
+</dl>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">技術規格</th>
+ <th scope="col">狀態</th>
+ <th scope="col">備註</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1', '#sec-12', 'Statements')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3', '#sec-12', 'Statements')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12', 'Statements')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>New: function*, let, for...of, yield, class</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/docs/Web/JavaScript/Reference/Operators">運算式與運算子</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/label/index.html b/files/zh-tw/web/javascript/reference/statements/label/index.html
new file mode 100644
index 0000000000..4939b7b95f
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/label/index.html
@@ -0,0 +1,203 @@
+---
+title: label
+slug: Web/JavaScript/Reference/Statements/label
+tags:
+ - JavaScript
+ - Statement
+ - 陳述式
+translation_of: Web/JavaScript/Reference/Statements/label
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><strong>標記陳述式</strong>可以和 {{jsxref("Statements/break", "break")}} 或 {{jsxref("Statements/continue", "continue")}} 語句一起使用。標記就是在一條陳述式前面加個可以引用的識別符號。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-label.html")}}</div>
+
+
+
+<div class="note">
+<p>標記的迴圈或程式碼區塊非常罕見。通常可以使用函式呼叫而不是使用迴圈跳轉。</p>
+</div>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox"><em>label</em> :
+ <em>statement</em>
+</pre>
+
+<dl>
+ <dt><code>label</code></dt>
+ <dd>任何不是保留字的 JavaScript 識別符號。</dd>
+ <dt><code>statement</code></dt>
+ <dd>一個 JavaScript 陳述式。<code>break</code> 可用於任何標記陳述式,而 <code>continue</code> 可用於循環標記陳述式。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>可使用一個標籤來唯一標記一個循環,然後使用 <code>break</code> 或 <code>continue</code> 陳述式來指示程式是否中斷循環或繼續執行。</p>
+
+<p>需要注意的是 JavaScript <strong>沒有</strong> <code>goto</code> 陳述式,標記只能和 <code>break</code> 或 <code>continue</code> 一起使用。</p>
+
+<p>在<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">嚴格模式</a>中,你不能使用 “<code>let</code>” 作為標籤名稱。它會拋出一個<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError" title="SyntaxError 物件代表嘗試解析語法上不合法的程式碼的錯誤。"><code>SyntaxError</code></a>(let 是一個保留的識別符號)。</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="在_for_迴圈中使用帶標記的_continue">在 <code>for</code> 迴圈中使用帶標記的 <code>continue</code> </h3>
+
+<pre class="brush: js">var i, j;
+
+loop1:
+for (i = 0; i &lt; 3; i++) { //The first for statement is labeled "loop1"
+ loop2:
+ for (j = 0; j &lt; 3; j++) { //The second for statement is labeled "loop2"
+ if (i === 1 &amp;&amp; j === 1) {
+ continue loop1;
+ }
+ console.log('i = ' + i + ', j = ' + j);
+ }
+}
+
+// Output is:
+// "i = 0, j = 0"
+// "i = 0, j = 1"
+// "i = 0, j = 2"
+// "i = 1, j = 0"
+// "i = 2, j = 0"
+// "i = 2, j = 1"
+// "i = 2, j = 2"
+// Notice how it skips both "i = 1, j = 1" and "i = 1, j = 2"
+</pre>
+
+<h3 id="使用帶標記的_continue_陳述式">使用帶標記的 <code>continue</code> 陳述式</h3>
+
+<p>給定一組資料和一組測試,下面的例子可以統計通過測試的資料。</p>
+
+<pre class="brush: js">var itemsPassed = 0;
+var i, j;
+
+top:
+for (i = 0; i &lt; items.length; i++) {
+ for (j = 0; j &lt; tests.length; j++) {
+ if (!tests[j].pass(items[i])) {
+ continue top;
+ }
+ }
+
+ itemsPassed++;
+}</pre>
+
+<h3 id="在_for_迴圈中使用帶標記的_break">在 <code>for</code> 迴圈中使用帶標記的 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(255, 255, 255, 0.4);">break</span></font> </h3>
+
+<pre class="brush: js">var i, j;
+
+loop1:
+for (i = 0; i &lt; 3; i++) { //The first for statement is labeled "loop1"
+ loop2:
+ for (j = 0; j &lt; 3; j++) { //The second for statement is labeled "loop2"
+ if (i === 1 &amp;&amp; j === 1) {
+ break loop1;
+ }
+ console.log('i = ' + i + ', j = ' + j);
+ }
+}
+
+// Output is:
+// "i = 0, j = 0"
+// "i = 0, j = 1"
+// "i = 0, j = 2"
+// "i = 1, j = 0"
+// Notice the difference with the previous continue example</pre>
+
+<h3 id="使用帶標記_break_陳述式">使用帶標記 <code>break</code> 陳述式</h3>
+
+<p>給定一組資料和一組測試,下面的例子判斷是否所有的資料均通過了測試。</p>
+
+<pre class="brush: js">var allPass = true;
+var i, j;
+
+top:
+for (i = 0; items.length; i++)
+ for (j = 0; j &lt; tests.length; i++)
+ if (!tests[j].pass(items[i])) {
+ allPass = false;
+ break top;
+ }</pre>
+
+<h3 id="在標記的區塊中使用_break">在標記的區塊中使用 <code>break</code></h3>
+
+<p>你可以在程式碼區塊中使用標記,但只有 <code>break</code> 陳述式可以使用非迴圈的標記。</p>
+
+<pre class="brush: js">foo: {
+ console.log('face');
+ break foo;
+ console.log('this will not be executed');
+}
+console.log('swap');
+
+// this will log:
+
+// "face"
+// "swap </pre>
+
+<h3 id="標記的函式宣告式">標記的函式宣告式</h3>
+
+<p>從 ECMAScript 2015 開始,標準的函式宣告式現在對規範的 <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-labelled-function-declarations" rel="noopener">Web 相容性附件</a>中的非嚴格程式碼進行了標準化。</p>
+
+<pre class="brush: js">L: function F() {}</pre>
+
+<p>在<a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Strict_mode">嚴格模式</a>中,這會拋出 {{jsxref("SyntaxError")}} 例外:</p>
+
+<pre class="brush: js">'use strict';
+L: function F() {}
+// SyntaxError: functions cannot be labelled</pre>
+
+<p><a href="https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Statements/function*">產生器函式</a>既不能在嚴格模式中標記,也不能在非嚴格模式中標記:</p>
+
+<pre class="brush: js">L: function* F() {}
+// SyntaxError: generator functions cannot be labelled
+</pre>
+
+<h2 id="規格">規格</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.12', 'Labelled statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-labelled-statements', 'Labelled statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-labelled-statements', 'Labelled statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.label")}}</p>
+
+<h2 id="相關連結">相關連結</h2>
+
+<ul>
+ <li>{{jsxref("Statements/break", "break")}}</li>
+ <li>{{jsxref("Statements/continue", "continue")}}</li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/let/index.html b/files/zh-tw/web/javascript/reference/statements/let/index.html
new file mode 100644
index 0000000000..0cdc8806be
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/let/index.html
@@ -0,0 +1,246 @@
+---
+title: let
+slug: Web/JavaScript/Reference/Statements/let
+translation_of: Web/JavaScript/Reference/Statements/let
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><strong><code>let</code></strong>用於宣告一個「只作用在當前區塊的變數」,初始值可選擇性的設定。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-let.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox notranslate">let var1 [= value1] [, var2 [= value2]] [, ..., varN [= valueN]];</pre>
+
+<h3 id="參數">參數</h3>
+
+<dl>
+ <dt><code>var1</code>, <code>var2</code>, …, <code>varN</code></dt>
+ <dd>變數名稱。</dd>
+ <dt><code>value1</code>, <code>value2</code>, …, <code>valueN</code></dt>
+ <dd>變數的初始值,可以是任何合法的表達式。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p><code>let</code> 可以宣告只能在目前區塊、階段或表達式中作用的變數。而 <code><a href="https://developer.mozilla.org/zh-TW/docs/JavaScript/Reference/Statements/var" title="JavaScript/Reference/Statements/var">var</a> 則是定義了一個全域變數,或是在整個 function 而不管該區塊範圍。</code></p>
+
+<h3 id="Scoping_rules">Scoping rules</h3>
+
+<p>宣告 <code>let</code> 的作用範圍是它們被定義的區塊,以及該區塊包含的子區塊。這樣看起來功能跟 <strong><code>var</code></strong> 很相似。主要不同的地方在於 <strong><code>var</code></strong> 作用範圍是「整個」function:</p>
+
+<pre class="brush:js notranslate">function varTest() {
+ var x = 1;
+ {
+ var x = 2; // 這裡的 x 與 function 區塊內部的 x 是一樣的,因此會影響 function 區塊內所有的 x
+ console.log(x); // 2
+ }
+ console.log(x); // 2
+}
+
+function letTest() {
+ let x = 1;
+ {
+ let x = 2; // 這裡的 x 與 function 區塊內部的 x 是不同的,只會作用在這層 block 區塊中
+ console.log(x); // 2
+ }
+ console.log(x); // 1
+}</pre>
+
+<p>在上列例子裡的最前行 <code>let</code> 和 <code>var</code> 不同,<code>let</code> 並不會在全域物件中建立變數。舉例來說:</p>
+
+<pre class="brush:js notranslate">var x = 'global';
+let y = 'global';
+console.log(this.x); // "global"
+console.log(this.y); // undefined
+</pre>
+
+<h3 id="Emulating_private_members">Emulating private members</h3>
+
+<p>In dealing with <a href="/en-US/docs/Glossary/Constructor">constructors</a> it is possible to use the <strong><code>let</code></strong> bindings to share one or more private members without using <a href="/en-US/docs/Web/JavaScript/Closures">closures</a>:</p>
+
+<pre class="brush:js notranslate">var Thing;
+
+{
+ let privateScope = new WeakMap();
+ let counter = 0;
+
+ Thing = function() {
+ this.someProperty = 'foo';
+
+ privateScope.set(this, {
+ hidden: ++counter,
+ });
+ };
+
+ Thing.prototype.showPublic = function() {
+ return this.someProperty;
+ };
+
+ Thing.prototype.showPrivate = function() {
+ return privateScope.get(this).hidden;
+ };
+}
+
+console.log(typeof privateScope);
+// "undefined"
+
+var thing = new Thing();
+
+console.log(thing);
+// Thing {someProperty: "foo"}
+
+thing.showPublic();
+// "foo"
+
+thing.showPrivate();
+// 1
+</pre>
+
+<h3 id="Temporal_Dead_Zone_and_errors_with_let">Temporal Dead Zone and errors with <code>let</code></h3>
+
+<p>Redeclaring the same variable within the same function or block scope raises a {{jsxref("SyntaxError")}}.</p>
+
+<pre class="brush: js example-bad notranslate">if (x) {
+ let foo;
+ let foo; // SyntaxError thrown.
+}</pre>
+
+<p>In ECMAScript 2015, <strong><code>let</code></strong> bindings are not subject to <strong>Variable Hoisting</strong>, which means that <strong><code>let</code></strong> declarations do not move to the top of the current execution context. Referencing the variable in the block before the initialization results in a <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError">ReferenceError</a></code> (contrary to a variable declared with <a href="/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting">var</a>, which will just have the undefined value). The variable is in a "temporal dead zone" from the start of the block until the initialization is processed.</p>
+
+<pre class="brush: js notranslate">function do_something() {
+ console.log(foo); // ReferenceError
+ let foo = 2;
+}</pre>
+
+<p>你可能會在 <a href="https://developer.mozilla.org/zh-TW/docs/JavaScript/Reference/Statements/switch" title="switch"><code>switch</code></a> 中遇到錯誤,因為所有的 <code>case</code> 都屬於同樣的區塊中。</p>
+
+<pre class="brush: js notranslate">switch (x) {
+ case 0:
+ let foo;
+ break;
+
+ case 1:
+ let foo; // SyntaxError for redeclaration.
+ break;
+}</pre>
+
+<h3 id="let_於_for_迴圈的宣告範圍"><code>let</code> 於 <code>for</code> 迴圈的宣告範圍</h3>
+
+<p>You can use the <code>let</code> keyword to bind variables locally in the scope of <code>for</code> loops. This is different from the var keyword in the head of a for loop, which makes the variables visible in the whole function containing the loop.</p>
+
+<pre class="brush:js notranslate">var i=0;
+for ( let i=i ; i &lt; 10 ; i++ ) {
+ console.log(i);
+}
+</pre>
+
+<p>However, it's important to point out that a block nested inside a case clause will create a new block scoped lexical environment, which will not produce the redeclaration errors shown above.</p>
+
+<pre class="brush: js notranslate">let x = 1;
+
+switch(x) {
+ case 0: {
+ let foo;
+ break;
+ }
+ case 1: {
+ let foo;
+ break;
+ }
+}</pre>
+
+<h3 id="The_temporal_dead_zone_and_typeof">The temporal dead zone and <code>typeof</code></h3>
+
+<p>Unlike with simply undeclared variables and variables that hold a value of <code>undefined</code>, using the <code>typeof</code> operator to check for the type of a variable in that variable's TDZ will throw a <code>ReferenceError</code>:</p>
+
+<pre class="brush: js notranslate">// prints out 'undefined'
+console.log(typeof undeclaredVariable);
+// results in a 'ReferenceError'
+console.log(typeof i);
+let i = 10;</pre>
+
+<h3 id="Another_example_of_temporal_dead_zone_combined_with_lexical_scoping">Another example of temporal dead zone combined with lexical scoping</h3>
+
+<p>Due to lexical scoping, the identifier<strong> "foo"</strong> inside the expression <code>(foo + 55)</code> evaluates to the <u>if block's foo</u>, and <strong>not</strong> the <u>overlying variable foo</u> with the value of 33.<br>
+ In that very line, the <u>if block's "foo"</u> has already been created in the lexical environment, but has not yet reached (and <strong>terminated</strong>) its initialization (which is part of the statement itself): it's still in the temporal dead zone.</p>
+
+<pre class="brush: js example-bad notranslate">function test(){
+ var foo = 33;
+ {
+ let foo = (foo + 55); // ReferenceError
+ }
+}
+test();</pre>
+
+<p>This phenomenon may confuse you in a situation like the following. The instruction <code>let n of n.a</code> is already inside the private scope of the <u>for loop's block</u>, hence the identifier<strong> "n.a"</strong> is resolved to the property 'a' of the <u>'n' object located in the first part of the instruction itself</u> ("let n"), which is still in the temporal dead zone since its declaration statement has not been reached and <strong>terminated</strong>.</p>
+
+<pre class="brush: js example-bad notranslate">function go(n) {
+ // n here is defined!
+ console.log(n); // Object {a: [1,2,3]}
+
+ for (let n of n.a) { // ReferenceError
+ console.log(n);
+ }
+}
+
+go({a: [1, 2, 3]});
+</pre>
+
+<h2 id="Other_situations">Other situations</h2>
+
+<p>When used inside a block, <strong><code>let</code></strong> limits the variable's scope to that block. Note the difference between <code><strong>var</strong></code><em> </em>whose scope is inside the function where it is declared.</p>
+
+<pre class="brush: js notranslate">var a = 1;
+var b = 2;
+
+if (a === 1) {
+ var a = 11; // the scope is global
+ let b = 22; // the scope is inside the if-block
+
+ console.log(a); // 11
+ console.log(b); // 22
+}
+
+console.log(a); // 11
+console.log(b); // 2</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-let-and-const-declarations', 'Let and Const Declarations')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition. Does not specify let expressions or let blocks.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-let-and-const-declarations', 'Let and Const Declarations')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.let")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/var"><code>var</code></a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Statements/const"><code>const</code></a></li>
+ <li><a href="https://hacks.mozilla.org/2015/07/es6-in-depth-let-and-const/">ES6 In Depth: <code>let</code> and <code>const</code></a></li>
+ <li><a href="https://blog.mozilla.org/addons/2015/10/14/breaking-changes-let-const-firefox-nightly-44/">Breaking changes in <code>let</code> and <code>const</code> in Firefox 44.</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/return/index.html b/files/zh-tw/web/javascript/reference/statements/return/index.html
new file mode 100644
index 0000000000..e207c2c6f3
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/return/index.html
@@ -0,0 +1,156 @@
+---
+title: return
+slug: Web/JavaScript/Reference/Statements/return
+translation_of: Web/JavaScript/Reference/Statements/return
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><strong><code>return</code> 表達式</strong>會終止函式執行,並指明函式呼叫器(function caller)要回傳的數值。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-return.html")}}</div>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">return [[expression]]; </pre>
+
+<dl>
+ <dt><code>expression</code></dt>
+ <dd>要被回傳的表達式。如果省略了表達式,函式就會回傳 <code>undefined</code>。</dd>
+</dl>
+
+<h2 id="敘述">敘述</h2>
+
+<p>如果在 function body 內宣告 <code>return</code> 的話,函式執行就會終止。如果指定數值的話,函式呼叫器就會回傳給定的數值。例如說,以下函式會回傳 <code>x</code> 參數的次方數。</p>
+
+<pre class="brush: js">function square(x) {
+ return x * x;
+}
+var demo = square(3);
+// demo will equal 9
+</pre>
+
+<p>如果省略了表達式,函式就會回傳 <code>undefined</code>。</p>
+
+<p>以下所有的 return 宣告都會終止函式執行:</p>
+
+<pre class="brush: js">return;
+return true;
+return false;
+return x;
+return x + y / 3;
+</pre>
+
+<h3 id="自動插入分號">自動插入分號</h3>
+
+<p><code>return</code> 宣告會受<a href="/zh-TW/docs/Web/JavaScript/Reference/Lexical_grammar#Automatic_semicolon_insertion">自動插入分號</a>(automatic semicolon insertion,ASI)影響。No line terminator is allowed between the <code>return</code> keyword and the expression.</p>
+
+<pre class="brush: js">return
+a + b;
+</pre>
+
+<p>會因為 ASI 而變成:</p>
+
+<pre class="brush: js">return;
+a + b;
+</pre>
+
+<p>主控台會警告「unreachable code after return statement」(在 return 宣告後面有無法抵達的程式碼)。</p>
+
+<div class="note">從 Gecko 40 {{geckoRelease(40)}} 開始,如果主控台發現在 return 宣告後面有無法抵達的程式碼,就會顯示警告。</div>
+
+<p>要避免 ASI 問題,可以添加括號:</p>
+
+<pre class="brush: js">return (
+  a + b
+);
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="終止函式">終止函式</h3>
+
+<p>在到達呼叫 <code>return</code> 的地方後,函式會立即停止。</p>
+
+<pre class="brush: js">function counter() {
+ for (var count = 1; ; count++) { // 無限迴圈
+ console.log(count + 'A'); // 直到 5
+ if (count === 5) {
+ return;
+ }
+ console.log(count + 'B'); // 直到 4
+ }
+ console.log(count + 'C'); // 永不顯示
+}
+
+counter();
+
+// 輸出:
+// 1A
+// 1B
+// 2A
+// 2B
+// 3A
+// 3B
+// 4A
+// 4B
+// 5A
+</pre>
+
+<h3 id="函式回傳">函式回傳</h3>
+
+<p>請參見<a href="/zh-TW/docs/Web/JavaScript/Closures">閉包</a>。</p>
+
+<pre class="brush: js">function magic(x) {
+ return function calc(x) { return x * 42; };
+}
+
+var answer = magic();
+answer(1337); // 56154
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">規範</th>
+ <th scope="col">狀態</th>
+ <th scope="col">註解</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>初始定義</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.9', 'Return statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-return-statement', 'Return statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-return-statement', 'Return statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.return")}}</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Reference/Functions_and_function_scope" title="En/Core_JavaScript_1.5_Reference/Functions">函式</a></li>
+ <li><a href="/zh-TW/docs/Web/JavaScript/Closures">閉包</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/switch/index.html b/files/zh-tw/web/javascript/reference/statements/switch/index.html
new file mode 100644
index 0000000000..b182da09b6
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/switch/index.html
@@ -0,0 +1,309 @@
+---
+title: switch
+slug: Web/JavaScript/Reference/Statements/switch
+tags:
+ - JavaScript
+translation_of: Web/JavaScript/Reference/Statements/switch
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<div><span class="seoSummary"><strong><code>switch</code> 語句</strong> 會比對一個 <a href="/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators">表達式</a> 裡頭的值是否符合 <code>case</code> 條件,然後執行跟這個條件相關的 <a href="/en-US/docs/Web/JavaScript/Reference/Statements">陳述式</a>, 以及此一符合條件以外,剩下其他條件裡的陳述式。</span></div>
+
+<div></div>
+
+<p>{{EmbedInteractiveExample("pages/js/statement-switch.html")}}      </p>
+
+
+
+<h2 id="語法">語法</h2>
+
+<pre class="brush: js">switch (expression) {
+ case value1:
+ //當 expression 的值符合 value1
+ //要執行的陳述句
+ [break;]
+ case value2:
+ //當 expression 的值符合 value2
+ //要執行的陳述句
+ [break;]
+ ...
+ case valueN:
+ //當 expression 的值符合 valueN
+ //要執行的陳述句
+ [break;]
+ [default:
+ //當 expression 的值都不符合上述條件
+ //要執行的陳述句
+ [break;]]
+}</pre>
+
+<dl>
+ <dt><code>expression</code></dt>
+ <dd>一個表達式其結果用來跟每個 <code>case</code> 條件比對。</dd>
+ <dt><code>case valueN</code> {{optional_inline}}</dt>
+ <dd>一個 <code>case</code> 條件是用來跟 <code>expression</code> 匹配的。 如果 <code>expression</code> 符合特定的 <code>valueN</code>,那在case條件裡的語句就會執行,直到這個 <code>switch</code> 陳述式結束或遇到一個 <code>break</code> 。</dd>
+ <dt><code>default</code> {{optional_inline}}</dt>
+ <dd>一個 <code>default</code> 條件;倘若有這個條件,那在 <code>expression</code> 的值並不符合任何一個 <code>case</code> 條件的情況下,就會執行這個條件裡的語句。</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>一個 switch 陳述式會先評估自己的 expression。然後他會按照 <code>case</code> 條件順序開始尋找,直到比對到第一個表達式值跟輸入 expression 的值相等的 case 條件(使用<a href="/zh-TW/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">嚴格的邏輯運算子</a>, <code>===</code>)並把控制流交給該子句、並執行裡面的陳述式(如果給定值符合多個 case,就執行第一個符合的 case,就算該 case 與其他 case 不同)</p>
+
+<p>If no matching <code>case</code> clause is found, the program looks for the optional <code>default</code> clause, and if found, transfers control to that clause, executing the associated statements. If no <code>default</code> clause is found, the program continues execution at the statement following the end of <code>switch</code>. 按照慣例, <code>default</code> 語句會是最後一個條件,但不一定要存在。</p>
+
+<p>The optional <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/break" title="JavaScript/Reference/Statements/break">break</a></code> statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues execution at the statement following switch. If <code>break</code> is omitted, the program continues execution at the next statement in the <code>switch</code> statement.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="使用_switch">使用 <code>switch</code></h3>
+
+<p>In the following example, if <code>expr</code> evaluates to "Bananas", the program matches the value with case "Bananas" and executes the associated statement. When <code>break</code> is encountered, the program breaks out of <code>switch</code> and executes the statement following <code>switch</code>. If <code>break</code> were omitted, the statement for case "Cherries" would also be executed.</p>
+
+<pre class="brush: js">switch (expr) {
+ case 'Oranges':
+ console.log('Oranges are $0.59 a pound.');
+ break;
+ case 'Apples':
+ console.log('Apples are $0.32 a pound.');
+ break;
+ case 'Bananas':
+ console.log('Bananas are $0.48 a pound.');
+ break;
+ case 'Cherries':
+ console.log('Cherries are $3.00 a pound.');
+ break;
+ case 'Mangoes':
+ case 'Papayas':
+ console.log('Mangoes and papayas are $2.79 a pound.');
+ break;
+ default:
+ console.log('Sorry, we are out of ' + expr + '.');
+}
+
+console.log("Is there anything else you'd like?");
+</pre>
+
+<h3 id="如果我忘記_break_會發生什麼事?">如果我忘記 break 會發生什麼事?</h3>
+
+<p>If you forget a break then the script will run from the case where the criterion is met and will run the case after that regardless if criterion was met. See example here:</p>
+
+<pre class="brush: js">var foo = 0;
+switch (foo) {
+ case -1:
+ console.log('negative 1');
+ break;
+ case 0: // foo is 0 so criteria met here so this block will run
+ console.log(0);
+ // NOTE: the forgotten break would have been here
+ case 1: // no break statement in 'case 0:' so this case will run as well
+ console.log(1);
+ break; // it encounters this break so will not continue into 'case 2:'
+ case 2:
+ console.log(2);
+ break;
+ default:
+ console.log('default');
+}</pre>
+
+<h3 id="我可以在_cases_中間放_default_嗎?">我可以在 cases 中間放 default 嗎?</h3>
+
+<p>Yes, you can! JavaScript will drop you back to the default if it can't find a match:</p>
+
+<pre class="brush: js">var foo = 5;
+switch (foo) {
+ case 2:
+  console.log(2);
+  break; // it encounters this break so will not continue into 'default:'
+  default:
+  console.log('default')
+  // fall-through
+ case 1:
+ console.log('1');
+}
+</pre>
+
+<p>It also works when you put default before all other cases.</p>
+
+<h3 id="同時使用多個條件_case_的方法">同時使用多個條件 case 的方法</h3>
+
+<p>Source for this technique is here:</p>
+
+<p><a href="http://stackoverflow.com/questions/13207927/switch-statement-multiple-cases-in-javascript">Switch statement multiple cases in JavaScript (Stack Overflow)</a></p>
+
+<h4 id="Multi-case_-_single_operation">Multi-case - single operation</h4>
+
+<p>This method takes advantage of the fact that if there is no break below a case statement it will continue to execute the next case statement regardless if the case meets the criteria. See the section titled "What happens if I forgot a break?"</p>
+
+<p>This is an example of a single operation sequential switch statement, where four different values perform exactly the same.</p>
+
+<pre class="brush: js">var Animal = 'Giraffe';
+switch (Animal) {
+ case 'Cow':
+ case 'Giraffe':
+ case 'Dog':
+ case 'Pig':
+ console.log('This animal will go on Noah\'s Ark.');
+ break;
+ case 'Dinosaur':
+ default:
+ console.log('This animal will not.');
+}</pre>
+
+<h4 id="Multi-case_-_chained_operations">Multi-case - chained operations</h4>
+
+<p>This is an example of a multiple-operation sequential switch statement, where, depending on the provided integer, you can receive different output. This shows you that it will traverse in the order that you put the case statements, and it does not have to be numerically sequential. In JavaScript, you can even mix in definitions of strings into these case statements as well.</p>
+
+<pre class="brush: js">var foo = 1;
+var output = 'Output: ';
+switch (foo) {
+ case 0:
+ output += 'So ';
+ case 1:
+ output += 'What ';
+ output += 'Is ';
+ case 2:
+ output += 'Your ';
+ case 3:
+ output += 'Name';
+ case 4:
+ output += '?';
+ console.log(output);
+ break;
+ case 5:
+ output += '!';
+ console.log(output);
+ break;
+ default:
+ console.log('Please pick a number from 0 to 5!');
+}</pre>
+
+<p>The output from this example:</p>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Value</th>
+ <th scope="col">Log text</th>
+ </tr>
+ <tr>
+ <td>foo is NaN or not 1, 2, 3, 4, 5 or 0</td>
+ <td>Please pick a number from 0 to 5!</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>Output: So What Is Your Name?</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>Output: What Is Your Name?</td>
+ </tr>
+ <tr>
+ <td>2</td>
+ <td>Output: Your Name?</td>
+ </tr>
+ <tr>
+ <td>3</td>
+ <td>Output: Name?</td>
+ </tr>
+ <tr>
+ <td>4</td>
+ <td>Output: ?</td>
+ </tr>
+ <tr>
+ <td>5</td>
+ <td>Output: !</td>
+ </tr>
+ </tbody>
+</table>
+
+<h3 id="Block-scope_variables_within_switch_statements">Block-scope variables within <code>switch</code> statements</h3>
+
+<p>With ECMAScript 2015 (ES6) support made available in most modern browsers, there will be cases where you would want to use <a href="/en-US/docs/Web/JavaScript/Reference/Statements/let">let</a> and <a href="/en-US/docs/Web/JavaScript/Reference/Statements/const">const</a> statements to declare block-scoped variables.</p>
+
+<p>Take a look at this example:</p>
+
+<pre class="brush: js">const action = 'say_hello';
+switch (action) {
+  case 'say_hello':
+    let message = 'hello';
+    console.log(message);
+    break;
+  case 'say_hi':
+    let message = 'hi';
+    console.log(message);
+    break;
+  default:
+    console.log('Empty action received.');
+    break;
+}</pre>
+
+<p>This example will output the error <code>Uncaught SyntaxError: Identifier 'message' has already been declared</code> which you were not probably expecting.</p>
+
+<p>This is because the first <code>let message = 'hello';</code> conflicts with second let statement <code>let message = 'hi';</code> even they're within their own separate case statements <code>case 'say_hello':</code> and <code>case 'say_hi':</code>; ultimately this is due to both <code>let</code> statements being interpreted as duplicate declarations of the same variable name within the same block scope.</p>
+
+<p>We can easily fix this by wrapping our case statements with brackets:</p>
+
+<pre class="brush: js">const action = 'say_hello';
+switch (action) {
+  case 'say_hello': <strong>{ // added brackets</strong>
+    let message = 'hello';
+    console.log(message);
+    break;
+  <strong>} // added brackets</strong>
+  case 'say_hi': <strong>{ // added brackets</strong>
+    let message = 'hi';
+    console.log(message);
+    break;
+  <strong>} // added brackets</strong>
+  default: <strong>{ // added brackets</strong>
+    console.log('Empty action received.');
+    break;
+ <strong>} // added brackets</strong>
+}</pre>
+
+<p>This code will now output <code>hello</code> in the console as it should, without any errors at all.</p>
+
+<h2 id="技術規範">技術規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.2</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.11', 'switch statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-switch-statement', 'switch statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-switch-statement', 'switch statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+
+
+<p>{{Compat("javascript.statements.switch")}}</p>
+
+<h2 id="你也可以看看">你也可以看看</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/if...else"><code>if...else</code></a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/throw/index.html b/files/zh-tw/web/javascript/reference/statements/throw/index.html
new file mode 100644
index 0000000000..dbfe664ef5
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/throw/index.html
@@ -0,0 +1,234 @@
+---
+title: throw
+slug: Web/JavaScript/Reference/Statements/throw
+translation_of: Web/JavaScript/Reference/Statements/throw
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p>The <strong><code>throw</code> statement</strong> throws a user-defined exception. Execution of the current function will stop (the statements after <code>throw</code> won't be executed), and control will be passed to the first <a href="/en-US/docs/Web/JavaScript/Reference/Statements/try...catch"><code>catch</code></a> block in the call stack. If no <code>catch</code> block exists among caller functions, the program will terminate.</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">throw <em>expression</em>; </pre>
+
+<dl>
+ <dt><code>expression</code></dt>
+ <dd>The expression to throw.</dd>
+</dl>
+
+<h2 id="描述">描述</h2>
+
+<p>Use the <code>throw</code> statement to throw an exception. When you throw an exception, <code>expression</code> specifies the value of the exception. Each of the following throws an exception:</p>
+
+<pre class="brush: js">throw 'Error2'; // generates an exception with a string value
+throw 42; // generates an exception with the value 42
+throw true; // generates an exception with the value true</pre>
+
+<p>Also note that the <code>throw</code> statement is affected by <a href="/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Automatic_semicolon_insertion">automatic semicolon insertion (ASI)</a> as no line terminator between the <code>throw</code> keyword and the expression is allowed.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Throw_an_object">Throw an object</h3>
+
+<p>You can specify an object when you throw an exception. You can then reference the object's properties in the <code>catch</code> block. The following example creates an object of type <code>UserException</code> and uses it in a <code>throw</code> statement.</p>
+
+<pre class="brush: js">function UserException(message) {
+ this.message = message;
+ this.name = 'UserException';
+}
+function getMonthName(mo) {
+ mo = mo - 1; // Adjust month number for array index (1 = Jan, 12 = Dec)
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
+ 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+ if (months[mo] !== undefined) {
+ return months[mo];
+ } else {
+ throw new UserException('InvalidMonthNo');
+ }
+}
+
+try {
+ // statements to try
+ var myMonth = 15; // 15 is out of bound to raise the exception
+ var monthName = getMonthName(myMonth);
+} catch (e) {
+ monthName = 'unknown';
+ console.log(e.message, e.name); // pass exception object to err handler
+}
+</pre>
+
+<h3 id="Another_example_of_throwing_an_object">Another example of throwing an object</h3>
+
+<p>The following example tests an input string for a U.S. zip code. If the zip code uses an invalid format, the throw statement throws an exception by creating an object of type <code>ZipCodeFormatException</code>.</p>
+
+<pre class="brush: js">/*
+ * Creates a ZipCode object.
+ *
+ * Accepted formats for a zip code are:
+ * 12345
+ * 12345-6789
+ * 123456789
+ * 12345 6789
+ *
+ * If the argument passed to the ZipCode constructor does not
+ * conform to one of these patterns, an exception is thrown.
+ */
+
+function ZipCode(zip) {
+ zip = new String(zip);
+ pattern = /[0-9]{5}([- ]?[0-9]{4})?/;
+ if (pattern.test(zip)) {
+ // zip code value will be the first match in the string
+ this.value = zip.match(pattern)[0];
+ this.valueOf = function() {
+ return this.value
+ };
+ this.toString = function() {
+ return String(this.value)
+ };
+ } else {
+ throw new ZipCodeFormatException(zip);
+ }
+}
+
+function ZipCodeFormatException(value) {
+ this.value = value;
+ this.message = 'does not conform to the expected format for a zip code';
+ this.toString = function() {
+ return this.value + this.message;
+ };
+}
+
+/*
+ * This could be in a script that validates address data
+ * for US addresses.
+ */
+
+const ZIPCODE_INVALID = -1;
+const ZIPCODE_UNKNOWN_ERROR = -2;
+
+function verifyZipCode(z) {
+ try {
+ z = new ZipCode(z);
+ } catch (e) {
+ if (e instanceof ZipCodeFormatException) {
+ return ZIPCODE_INVALID;
+ } else {
+ return ZIPCODE_UNKNOWN_ERROR;
+ }
+ }
+ return z;
+}
+
+a = verifyZipCode(95060); // returns 95060
+b = verifyZipCode(9560); // returns -1
+c = verifyZipCode('a'); // returns -1
+d = verifyZipCode('95060'); // returns 95060
+e = verifyZipCode('95060 1234'); // returns 95060 1234
+</pre>
+
+<h3 id="Rethrow_an_exception">Rethrow an exception</h3>
+
+<p>You can use <code>throw</code> to rethrow an exception after you catch it. The following example catches an exception with a numeric value and rethrows it if the value is over 50. The rethrown exception propagates up to the enclosing function or to the top level so that the user sees it.</p>
+
+<pre class="brush: js">try {
+ throw n; // throws an exception with a numeric value
+} catch (e) {
+ if (e &lt;= 50) {
+ // statements to handle exceptions 1-50
+ } else {
+ // cannot handle this exception, so rethrow
+ throw e;
+ }
+}
+</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.4</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.13', 'throw statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-throw-statement', 'throw statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-throw-statement', 'throw statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/try...catch"><code>try...catch</code></a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/statements/var/index.html b/files/zh-tw/web/javascript/reference/statements/var/index.html
new file mode 100644
index 0000000000..705a27a333
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/statements/var/index.html
@@ -0,0 +1,248 @@
+---
+title: var
+slug: Web/JavaScript/Reference/Statements/var
+translation_of: Web/JavaScript/Reference/Statements/var
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p>宣告一個變數, 同時可以非強制性地賦予一初始值。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">var <em>varname1 [</em>= <em>value1 [</em>, <em>varname2 [</em>, <em>varname3 ... [</em>, <em>varnameN]]]]</em>;</pre>
+
+<dl>
+ <dt><code>varnameN</code></dt>
+ <dd>變數名稱。可以是任何合法的識別字符 (identifier)。</dd>
+</dl>
+
+<dl>
+ <dt><code>valueN</code></dt>
+ <dd>變數的初始值。可以是任何合法的表示式 (expression)。</dd>
+</dl>
+
+<h2 id="說明">說明</h2>
+
+<p>以 <code>var</code> 宣告的變數, 其作用範圍 (scope) 及於該函數之內; 但是如果在函數外宣告, 其作用範圍則為全域性 (global) (亦即包納於全域物件之內)。</p>
+
+<p>在函數之外使用以 <code>var</code> 宣告的變數是非強制的 (optional); 如果對一個未經宣告的變數賦值, 它會被暗中 (implicitly) 宣告成為一個全域變數 (亦即成為全域物件的屬性)。其中差異在於, 已宣告的變數是全域物件裡的一個無法變更 (non-configurable) 的屬性, 而未宣告的變數則是可變更的 (configurable)。</p>
+
+<p>因此, 建議你一定要宣告你的變數, 不管你要將它使用於全域範圍內或者函數內。</p>
+
+<p>若未宣告變數, 將非常可能導致無法預測的結果。所以, 在 ECMAScript 5 <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="Strict mode">strict mode</a> 中, 若在函數中給一個未經宣告的函數賦值, 將會丟出錯誤。</p>
+
+<p>Variable declarations, wherever they occur, are processed before any code is executed. The scope of a variable declared with <code>var</code> is its current <em>execution context</em>, which is either the enclosing function or, for variables declared outside any function, global.</p>
+
+<p>Assigning a value to an undeclared variable implicitly creates it as a global variable (it becomes a property of the global object) when the assignment is executed. The differences between declared and undeclared variables are:</p>
+
+<p>1. Declared variables are constrained in the execution context in which they are declared. Undeclared variables are always global.</p>
+
+<pre class="brush: js">function x() {
+ y = 1; // Throws a ReferenceError in strict mode
+ var z = 2;
+}
+
+x();
+
+console.log(y); // logs "1"
+console.log(z); // Throws a ReferenceError: z is not defined outside x
+</pre>
+
+<p>2. Declared variables are created before any code is executed. Undeclared variables do not exist until the code assigning to them is executed.</p>
+
+<pre class="brush: js">console.log(a); // Throws a ReferenceError.
+console.log('still going...'); // Never executes.</pre>
+
+<pre class="brush: js">var a;
+console.log(a); // logs "undefined" or "" depending on browser.
+console.log('still going...'); // logs "still going...".</pre>
+
+<p>3. Declared variables are a non-configurable property of their execution context (function or global). Undeclared variables are configurable (e.g. can be deleted).</p>
+
+<pre class="brush: js">var a = 1;
+b = 2;
+
+delete this.a; // Throws a TypeError in strict mode. Fails silently otherwise.
+delete this.b;
+
+console.log(a, b); // Throws a ReferenceError.
+// The 'b' property was deleted and no longer exists.</pre>
+
+<p>Because of these three differences, failure to declare variables will very likely lead to unexpected results. Thus <strong>it is recommended to always declare variables, regardless of whether they are in a function or global scope.</strong> And in ECMAScript 5 <a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode">strict mode</a>, assigning to an undeclared variable throws an error.</p>
+
+<h3 id="var_hoisting">var hoisting</h3>
+
+<p>在 JavaScript 中, 變數可以先使用再宣告。</p>
+
+<p>因此, 建議你永遠都把變數的宣告放在函數的最頂端。否則可能導致混亂的情況。</p>
+
+<p>Because variable declarations (and declarations in general) are processed before any code is executed, declaring a variable anywhere in the code is equivalent to declaring it at the top. This also means that a variable can appear to be used before it's declared. This behavior is called "hoisting", as it appears that the variable declaration is moved to the top of the function or global code.</p>
+
+<pre class="brush: js">bla = 2
+var bla;
+// ...
+
+// is implicitly understood as:
+
+var bla;
+bla = 2;
+</pre>
+
+<p>For that reason, it is recommended to always declare variables at the top of their scope (the top of global code and the top of function code) so it's clear which variables are function scoped (local) and which are resolved on the scope chain.</p>
+
+<h2 id="範例">範例</h2>
+
+<h3 id="Declaring_and_initializing_two_variables">Declaring and initializing two variables</h3>
+
+<pre class="brush: js">var a = 0, b = 0;
+</pre>
+
+<h3 id="Assigning_two_variables_with_single_string_value">Assigning two variables with single string value</h3>
+
+<pre class="brush: js">var a = "A";
+var b = a;
+
+// Equivalent to:
+
+var a, b = a = "A";
+</pre>
+
+<p>Be mindful of the order:</p>
+
+<pre class="brush: js">var x = y, y = 'A';
+console.log(x + y); // undefinedA
+</pre>
+
+<p>Here, <code>x</code> and <code>y</code> are declared before any code is executed, the assignments occur later. At the time "<code>x = y</code>" is evaluated, <code>y</code> exists so no <code>ReferenceError</code> is thrown and its value is '<code>undefined</code>'. So, <code>x</code> is assigned the undefined value. Then, <code>y</code> is assigned a value of 'A'. Consequently, after the first line, <code>x === undefined &amp;&amp; y === 'A'</code>, hence the result.</p>
+
+<h3 id="Initialization_of_several_variables">Initialization of several variables</h3>
+
+<pre class="brush: js">var x = 0;
+
+function f(){
+ var x = y = 1; // x is declared locally. y is not!
+}
+f();
+
+console.log(x, y); // Throws a ReferenceError in strict mode (y is not defined). 0, 1 otherwise.
+// In non-strict mode:
+// x is the global one as expected
+// y leaked outside of the function, though!</pre>
+
+<h3 id="Implicit_globals_and_outer_function_scope">Implicit globals and outer function scope</h3>
+
+<p>Variables that appear to be implicit globals may be references to variables in an outer function scope:</p>
+
+<pre class="brush: js">var x = 0; // x is declared global, then assigned a value of 0
+
+console.log(typeof z); // undefined, since z doesn't exist yet
+
+function a() { // when a is called,
+ var y = 2; // y is declared local to function a, then assigned a value of 2
+
+ console.log(x, y); // 0 2
+
+ function b() { // when b is called
+ x = 3; // assigns 3 to existing global x, doesn't create a new global var
+ y = 4; // assigns 4 to existing outer y, doesn't create a new global var
+ z = 5; // creates a new global variable z and assigns a value of 5.
+ } // (Throws a ReferenceError in strict mode.)
+
+ b(); // calling b creates z as a global variable
+ console.log(x, y, z); // 3 4 5
+}
+
+a(); // calling a also calls b
+console.log(x, z); // 3 5
+console.log(typeof y); // undefined as y is local to function a</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Initial definition. Implemented in JavaScript 1.0</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-12.2', 'var statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-variable-statement', 'variable statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-variable-statement', 'variable statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/let"><code>let</code></a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/const"><code>const</code></a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/strict_mode/index.html b/files/zh-tw/web/javascript/reference/strict_mode/index.html
new file mode 100644
index 0000000000..b37e56f1ca
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/strict_mode/index.html
@@ -0,0 +1,369 @@
+---
+title: Strict mode
+slug: Web/JavaScript/Reference/Strict_mode
+translation_of: Web/JavaScript/Reference/Strict_mode
+---
+<div>{{JsSidebar("More")}}</div>
+
+<p><a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript 5</a> 提供開發者語法嚴格、語法受限的模式 (strict mode) ,會影響語法的使用但沒支援受限模式的瀏覽器一樣可以跑,只是行為有很大的可能會跟你想的不一樣。所以別太依賴受限模式,除非你做過功能性測試。另外這個模式可以混用在普通模式裡,你可以利用這個特性慢慢把舊的程式碼轉變成完全嚴謹和低變化性的狀態。</p>
+
+<p>這個模式裡做了些語意上的修正:</p>
+
+<ol>
+ <li>透過拋出錯誤的方式消除一些安靜的錯誤(意指不再靜默地忽略某些錯誤)</li>
+ <li>修正會阻礙 JavaScript 引擎進行最佳化的錯誤: 相同的程式碼在嚴格模式有時候能運行得比非嚴格模式來的快</li>
+ <li>禁止使用一些有可能被未來版本 ECMAScript 定義的語法</li>
+</ol>
+
+<p>參考 <a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode">過渡到嚴格模式</a>,如果你希望將你的程式碼在  JavaScript 語法嚴格、語法受限下執行。</p>
+
+<div class="note">
+<p>Sometimes, you'll see the default, non-strict, mode referred to as "sloppy mode". This isn't an official term, but be aware of it, just in case.</p>
+</div>
+
+<h2 id="用法">用法</h2>
+
+<p>嚴格模式可以用於整份腳本或個別函數中。不要在封閉的大括弧內 <code>{}</code> 這樣做; 這麼做在上下文中是沒有效果的。<code>eval</code> 程式、<code>Function</code>、事件處理參數、傳入  {{domxref("WindowTimers.setTimeout()")}} 函數的字串都是整個腳本,開啟嚴格模式他也會如預期般運作。</p>
+
+<h3 id="Strict_mode_for_scripts">Strict mode for scripts</h3>
+
+<p>To invoke strict mode for an entire script, put the <em>exact</em> statement <code>"use strict";</code> (or <code>'use strict';</code>) before any other statements.</p>
+
+<pre class="brush: js">// Whole-script strict mode syntax
+'use strict';
+var v = "Hi! I'm a strict mode script!";
+</pre>
+
+<p>This syntax has a trap that has <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=579119">already bitten</a> <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=627531">a major site</a>: it isn't possible to blindly concatenate non-conflicting scripts. Consider concatenating a strict mode script with a non-strict mode script: the entire concatenation looks strict! The inverse is also true: non-strict plus strict looks non-strict. Concatenation of strict mode scripts with each other is fine, and concatenation of non-strict mode scripts is fine. Only concatenating strict and non-strict scripts is problematic. It is thus recommended that you enable strict mode on a function-by-function basis (at least during the transition period).</p>
+
+<p>You can also take the approach of wrapping the entire contents of a script in a function and having that outer function use strict mode. This eliminates the concatenation problem but it means that you have to explicitly export any global variables out of the function scope.</p>
+
+<h3 id="Strict_mode_for_functions">Strict mode for functions</h3>
+
+<p>Likewise, to invoke strict mode for a function, put the <em>exact</em> statement <code>"use strict";</code> (or <code>'use strict';</code>) in the function's body before any other statements.</p>
+
+<pre class="brush: js">function strict() {
+ // Function-level strict mode syntax
+ 'use strict';
+ function nested() { return 'And so am I!'; }
+ return "Hi! I'm a strict mode function! " + nested();
+}
+function notStrict() { return "I'm not strict."; }
+</pre>
+
+<h2 id="Changes_in_strict_mode">Changes in strict mode</h2>
+
+<p>Strict mode changes both syntax and runtime behavior. Changes generally fall into these categories: changes converting mistakes into errors (as syntax errors or at runtime), changes simplifying how the particular variable for a given use of a name is computed, changes simplifying <code>eval</code> and <code>arguments</code>, changes making it easier to write "secure" JavaScript, and changes anticipating future ECMAScript evolution.</p>
+
+<h3 id="Converting_mistakes_into_errors">Converting mistakes into errors</h3>
+
+<p>Strict mode changes some previously-accepted mistakes into errors. JavaScript was designed to be easy for novice developers, and sometimes it gives operations which should be errors non-error semantics. Sometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. Strict mode treats these mistakes as errors so that they're discovered and promptly fixed.</p>
+
+<p>First, strict mode makes it impossible to accidentally create global variables. In normal JavaScript mistyping a variable in an assignment creates a new property on the global object and continues to "work" (although future failure is possible: likely, in modern JavaScript). Assignments which would accidentally create global variables instead throw in strict mode:</p>
+
+<pre class="brush: js">'use strict';
+ // Assuming a global variable mistypedVariable exists
+mistypeVariable = 17; // this line throws a ReferenceError due to the
+ // misspelling of variable
+</pre>
+
+<p>Second, strict mode makes assignments which would otherwise silently fail to throw an exception. For example, <code>NaN</code> is a non-writable global variable. In normal code assigning to <code>NaN</code> does nothing; the developer receives no failure feedback. In strict mode assigning to <code>NaN</code> throws an exception. Any assignment that silently fails in normal code (assignment to a non-writable global or property, assignment to a getter-only property, assignment to a new property on a <a href="/en-US/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions" title="en-US/JavaScript/Reference/Global Objects/Object/preventExtensions">non-extensible</a> object) will throw in strict mode:</p>
+
+<pre class="brush: js">'use strict';
+
+// Assignment to a non-writable global
+var undefined = 5; // throws a TypeError
+var Infinity = 5; // throws a TypeError
+
+// Assignment to a non-writable property
+var obj1 = {};
+Object.defineProperty(obj1, 'x', { value: 42, writable: false });
+obj1.x = 9; // throws a TypeError
+
+// Assignment to a getter-only property
+var obj2 = { get x() { return 17; } };
+obj2.x = 5; // throws a TypeError
+
+// Assignment to a new property on a non-extensible object
+var fixed = {};
+Object.preventExtensions(fixed);
+fixed.newProp = 'ohai'; // throws a TypeError
+</pre>
+
+<p>Third, strict mode makes attempts to delete undeletable properties throw (where before the attempt would simply have no effect):</p>
+
+<pre class="brush: js">'use strict';
+delete Object.prototype; // throws a TypeError
+</pre>
+
+<p>Fourth, strict mode prior to Gecko 34 requires that all properties named in an object literal be unique. Normal code may duplicate property names, with the last one determining the property's value. But since only the last one does anything, the duplication is simply a vector for bugs, if the code is modified to change the property value other than by changing the last instance. Duplicate property names are a syntax error in strict mode:</p>
+
+<div class="note">
+<p>This is no longer the case in ECMAScript 2015 ({{bug(1041128)}}).</p>
+</div>
+
+<pre class="brush: js">'use strict';
+var o = { p: 1, p: 2 }; // !!! syntax error
+</pre>
+
+<p>Fifth, strict mode requires that function parameter names be unique. In normal code the last duplicated argument hides previous identically-named arguments. Those previous arguments remain available through <code>arguments[i]</code>, so they're not completely inaccessible. Still, this hiding makes little sense and is probably undesirable (it might hide a typo, for example), so in strict mode duplicate argument names are a syntax error:</p>
+
+<pre class="brush: js">function sum(a, a, c) { // !!! syntax error
+ 'use strict';
+ return a + b + c; // wrong if this code ran
+}
+</pre>
+
+<p>Sixth, strict mode in ECMAScript 5 forbids octal syntax. Octal syntax isn't part of ECMAScript 5, but it's supported in all browsers by prefixing the octal number with a zero: <code>0644 === 420</code> and <code>"\045" === "%"</code>. In ECMAScript 2015 Octal number is supported by prefixing a number with "<code>0</code>o". i.e. </p>
+
+<pre class="brush: js">var a = 0o10; // ES2015: Octal</pre>
+
+<p>Novice developers sometimes believe a leading zero prefix has no semantic meaning, so they use it as an alignment device — but this changes the number's meaning! The leading zero syntax for octals is rarely useful and can be mistakenly used, so strict mode makes it a syntax error:</p>
+
+<pre class="brush: js">'use strict';
+var sum = 015 + // !!! syntax error
+ 197 +
+ 142;
+
+var sumWithOctal = 0o10 + 8;
+console.log(sumWithOctal); // 16
+</pre>
+
+<p>Seventh, strict mode in ECMAScript 2015 forbids setting properties on {{Glossary("primitive")}} values. Without strict mode, setting properties is simply ignored (no-op), with strict mode, however, a {{jsxref("TypeError")}} is thrown.</p>
+
+<pre class="brush: js">(function() {
+'use strict';
+
+false.true = ''; // TypeError
+(14).sailing = 'home'; // TypeError
+'with'.you = 'far away'; // TypeError
+
+})();</pre>
+
+<h3 id="Simplifying_variable_uses">Simplifying variable uses</h3>
+
+<p>Strict mode simplifies how variable names map to particular variable definitions in the code. Many compiler optimizations rely on the ability to say that variable <em>X</em> is stored in <em>that</em> location: this is critical to fully optimizing JavaScript code. JavaScript sometimes makes this basic mapping of name to variable definition in the code impossible to perform until runtime. Strict mode removes most cases where this happens, so the compiler can better optimize strict mode code.</p>
+
+<p>First, strict mode prohibits <code>with</code>. The problem with <code>with</code> is that any name inside the block might map either to a property of the object passed to it, or to a variable in surrounding (or even global) scope, at runtime: it's impossible to know which beforehand. Strict mode makes <code>with</code> a syntax error, so there's no chance for a name in a <code>with</code> to refer to an unknown location at runtime:</p>
+
+<pre class="brush: js">'use strict';
+var x = 17;
+with (obj) { // !!! syntax error
+ // If this weren't strict mode, would this be var x, or
+ // would it instead be obj.x? It's impossible in general
+ // to say without running the code, so the name can't be
+ // optimized.
+ x;
+}
+</pre>
+
+<p>The simple alternative of assigning the object to a short name variable, then accessing the corresponding property on that variable, stands ready to replace <code>with</code>.</p>
+
+<p>Second, <a class="external" href="http://whereswalden.com/2011/01/10/new-es5-strict-mode-support-new-vars-created-by-strict-mode-eval-code-are-local-to-that-code-only/"><code>eval</code> of strict mode code does not introduce new variables into the surrounding scope</a>. In normal code <code>eval("var x;")</code> introduces a variable <code>x</code> into the surrounding function or the global scope. This means that, in general, in a function containing a call to <code>eval</code> every name not referring to an argument or local variable must be mapped to a particular definition at runtime (because that <code>eval</code> might have introduced a new variable that would hide the outer variable). In strict mode <code>eval</code> creates variables only for the code being evaluated, so <code>eval</code> can't affect whether a name refers to an outer variable or some local variable:</p>
+
+<pre class="brush: js">var x = 17;
+var evalX = eval("'use strict'; var x = 42; x;");
+console.assert(x === 17);
+console.assert(evalX === 42);
+</pre>
+
+<p>Relatedly, if the function <code>eval</code> is invoked by an expression of the form <code>eval(...)</code> in strict mode code, the code will be evaluated as strict mode code. The code may explicitly invoke strict mode, but it's unnecessary to do so.</p>
+
+<pre class="brush: js">function strict1(str) {
+ 'use strict';
+ return eval(str); // str will be treated as strict mode code
+}
+function strict2(f, str) {
+ 'use strict';
+ return f(str); // not eval(...): str is strict if and only
+ // if it invokes strict mode
+}
+function nonstrict(str) {
+ return eval(str); // str is strict if and only
+ // if it invokes strict mode
+}
+
+strict1("'Strict mode code!'");
+strict1("'use strict'; 'Strict mode code!'");
+strict2(eval, "'Non-strict code.'");
+strict2(eval, "'use strict'; 'Strict mode code!'");
+nonstrict("'Non-strict code.'");
+nonstrict("'use strict'; 'Strict mode code!'");
+</pre>
+
+<p>Thus names in strict mode <code>eval</code> code behave identically to names in strict mode code not being evaluated as the result of <code>eval</code>.</p>
+
+<p>Third, strict mode forbids deleting plain names. <code>delete name</code> in strict mode is a syntax error:</p>
+
+<pre class="brush: js">'use strict';
+
+var x;
+delete x; // !!! syntax error
+
+eval('var y; delete y;'); // !!! syntax error</pre>
+
+<h3 id="Making_eval_and_arguments_simpler">Making <code>eval</code> and <code>arguments</code> simpler</h3>
+
+<p>Strict mode makes <code>arguments</code> and <code>eval</code> less bizarrely magical. Both involve a considerable amount of magical behavior in normal code: <code>eval</code> to add or remove bindings and to change binding values, and <code>arguments</code> by its indexed properties aliasing named arguments. Strict mode makes great strides toward treating <code>eval</code> and <code>arguments</code> as keywords, although full fixes will not come until a future edition of ECMAScript.</p>
+
+<p>First, the names <code>eval</code> and <code>arguments</code> can't be bound or assigned in language syntax. All these attempts to do so are syntax errors:</p>
+
+<pre class="brush: js">'use strict';
+eval = 17;
+arguments++;
+++eval;
+var obj = { set p(arguments) { } };
+var eval;
+try { } catch (arguments) { }
+function x(eval) { }
+function arguments() { }
+var y = function eval() { };
+var f = new Function('arguments', "'use strict'; return 17;");
+</pre>
+
+<p>Second, strict mode code doesn't alias properties of <code>arguments</code> objects created within it. In normal code within a function whose first argument is <code>arg</code>, setting <code>arg</code> also sets <code>arguments[0]</code>, and vice versa (unless no arguments were provided or <code>arguments[0]</code> is deleted). <code>arguments</code> objects for strict mode functions store the original arguments when the function was invoked. <code>arguments[i]</code> does not track the value of the corresponding named argument, nor does a named argument track the value in the corresponding <code>arguments[i]</code>.</p>
+
+<pre class="brush: js">function f(a) {
+ 'use strict';
+ a = 42;
+ return [a, arguments[0]];
+}
+var pair = f(17);
+console.assert(pair[0] === 42);
+console.assert(pair[1] === 17);
+</pre>
+
+<p>Third, <code>arguments.callee</code> is no longer supported. In normal code <code>arguments.callee</code> refers to the enclosing function. This use case is weak: simply name the enclosing function! Moreover, <code>arguments.callee</code> substantially hinders optimizations like inlining functions, because it must be made possible to provide a reference to the un-inlined function if <code>arguments.callee</code> is accessed. <code>arguments.callee</code> for strict mode functions is a non-deletable property which throws when set or retrieved:</p>
+
+<pre class="brush: js">'use strict';
+var f = function() { return arguments.callee; };
+f(); // throws a TypeError
+</pre>
+
+<h3 id="Securing_JavaScript">"Securing" JavaScript</h3>
+
+<p>Strict mode makes it easier to write "secure" JavaScript. Some websites now provide ways for users to write JavaScript which will be run by the website <em>on behalf of other users</em>. JavaScript in browsers can access the user's private information, so such JavaScript must be partially transformed before it is run, to censor access to forbidden functionality. JavaScript's flexibility makes it effectively impossible to do this without many runtime checks. Certain language functions are so pervasive that performing runtime checks has considerable performance cost. A few strict mode tweaks, plus requiring that user-submitted JavaScript be strict mode code and that it be invoked in a certain manner, substantially reduce the need for those runtime checks.</p>
+
+<p>First, the value passed as <code>this</code> to a function in strict mode is not forced into being an object (a.k.a. "boxed"). For a normal function, <code>this</code> is always an object: either the provided object if called with an object-valued <code>this</code>; the value, boxed, if called with a Boolean, string, or number <code>this</code>; or the global object if called with an <code>undefined</code> or <code>null</code> <code>this</code>. (Use <a href="/en-US/Web/JavaScript/Reference/Global_Objects/Function/call" title="en-US/JavaScript/Reference/Global_Objects/Function/call"><code>call</code></a>, <a href="/en-US/Web/JavaScript/Reference/Global_Objects/Function/apply" title="en-US/JavaScript/Reference/Global_Objects/Function/apply"><code>apply</code></a>, or <a href="/en-US/Web/JavaScript/Reference/Global_Objects/Function/bind" title="en-US/JavaScript/Reference/Global_Objects/Function/bind"><code>bind</code></a> to specify a particular <code>this</code>.) Not only is automatic boxing a performance cost, but exposing the global object in browsers is a security hazard, because the global object provides access to functionality that "secure" JavaScript environments must restrict. Thus for a strict mode function, the specified <code>this</code> is not boxed into an object, and if unspecified, <code>this</code> will be <code>undefined</code>:</p>
+
+<pre class="brush: js">'use strict';
+function fun() { return this; }
+console.assert(fun() === undefined);
+console.assert(fun.call(2) === 2);
+console.assert(fun.apply(null) === null);
+console.assert(fun.call(undefined) === undefined);
+console.assert(fun.bind(true)() === true);
+</pre>
+
+<p>That means, among other things, that in browsers it's no longer possible to reference the <code>window</code> object through <code>this</code> inside a strict mode function.</p>
+
+<p>Second, in strict mode it's no longer possible to "walk" the JavaScript stack via commonly-implemented extensions to ECMAScript. In normal code with these extensions, when a function <code>fun</code> is in the middle of being called, <code>fun.caller</code> is the function that most recently called <code>fun</code>, and <code>fun.arguments</code> is the <code>arguments</code> for that invocation of <code>fun</code>. Both extensions are problematic for "secure" JavaScript, because they allow "secured" code to access "privileged" functions and their (potentially unsecured) arguments. If <code>fun</code> is in strict mode, both <code>fun.caller</code> and <code>fun.arguments</code> are non-deletable properties which throw when set or retrieved:</p>
+
+<pre class="brush: js">function restricted() {
+ 'use strict';
+ restricted.caller; // throws a TypeError
+ restricted.arguments; // throws a TypeError
+}
+function privilegedInvoker() {
+ return restricted();
+}
+privilegedInvoker();
+</pre>
+
+<p>Third, <code>arguments</code> for strict mode functions no longer provide access to the corresponding function call's variables. In some old ECMAScript implementations <code>arguments.caller</code> was an object whose properties aliased variables in that function. This is a <a class="external" href="http://stuff.mit.edu/iap/2008/facebook/">security hazard</a> because it breaks the ability to hide privileged values via function abstraction; it also precludes most optimizations. For these reasons no recent browsers implement it. Yet because of its historical functionality, <code>arguments.caller</code> for a strict mode function is also a non-deletable property which throws when set or retrieved:</p>
+
+<pre class="brush: js">'use strict';
+function fun(a, b) {
+ 'use strict';
+ var v = 12;
+ return arguments.caller; // throws a TypeError
+}
+fun(1, 2); // doesn't expose v (or a or b)
+</pre>
+
+<h3 id="Paving_the_way_for_future_ECMAScript_versions">Paving the way for future ECMAScript versions</h3>
+
+<p>Future ECMAScript versions will likely introduce new syntax, and strict mode in ECMAScript 5 applies some restrictions to ease the transition. It will be easier to make some changes if the foundations of those changes are prohibited in strict mode.</p>
+
+<p>First, in strict mode a short list of identifiers become reserved keywords. These words are <code>implements</code>, <code>interface</code>, <code>let</code>, <code>package</code>, <code>private</code>, <code>protected</code>, <code>public</code>, <code>static</code>, and <code>yield</code>. In strict mode, then, you can't name or use variables or arguments with these names.</p>
+
+<pre class="brush: js">function package(protected) { // !!!
+ 'use strict';
+ var implements; // !!!
+
+ interface: // !!!
+ while (true) {
+ break interface; // !!!
+ }
+
+ function private() { } // !!!
+}
+function fun(static) { 'use strict'; } // !!!
+
+</pre>
+
+<p>Two Mozilla-specific caveats: First, if your code is JavaScript 1.7 or greater (for example in chrome code or when using the right <code>&lt;script type=""&gt;</code>) and is strict mode code, <code>let</code> and <code>yield</code> have the functionality they've had since those keywords were first introduced. But strict mode code on the web, loaded with <code>&lt;script src=""&gt;</code> or <code>&lt;script&gt;...&lt;/script&gt;</code>, won't be able to use <code>let</code>/<code>yield</code> as identifiers. Second, while ES5 unconditionally reserves the words <code>class</code>, <code>enum</code>, <code>export</code>, <code>extends</code>, <code>import</code>, and <code>super</code>, before Firefox 5 Mozilla reserved them only in strict mode.</p>
+
+<p>Second, <a class="external" href="http://whereswalden.com/2011/01/24/new-es5-strict-mode-requirement-function-statements-not-at-top-level-of-a-program-or-function-are-prohibited/">strict mode prohibits function statements not at the top level of a script or function</a>. In normal code in browsers, function statements are permitted "everywhere". <em>This is not part of ES5 (or even ES3)!</em> It's an extension with incompatible semantics in different browsers. Future ECMAScript editions will hopefully specify new semantics for function statements not at the top level of a script or function. <a class="external" href="http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls">Prohibiting such function statements in strict mode</a> "clears the deck" for specification in a future ECMAScript release:</p>
+
+<pre class="brush: js">'use strict';
+if (true) {
+ function f() { } // !!! syntax error
+ f();
+}
+
+for (var i = 0; i &lt; 5; i++) {
+ function f2() { } // !!! syntax error
+ f2();
+}
+
+function baz() { // kosher
+ function eit() { } // also kosher
+}
+</pre>
+
+<p>This prohibition isn't strict mode proper, because such function statements are an extension of basic ES5. But it is the recommendation of the ECMAScript committee, and browsers will implement it.</p>
+
+<h2 id="Strict_mode_in_browsers">Strict mode in browsers</h2>
+
+<p>The major browsers now implement strict mode. However, don't blindly depend on it since there still are numerous <a class="external" href="http://caniuse.com/use-strict" rel="external" title="caniuse.com availability of strict mode">Browser versions used in the wild that only have partial support for strict mode</a> or do not support it at all (e.g. Internet Explorer below version 10!). <em>Strict mode changes semantics.</em> Relying on those changes will cause mistakes and errors in browsers which don't implement strict mode. Exercise caution in using strict mode, and back up reliance on strict mode with feature tests that check whether relevant parts of strict mode are implemented. Finally, make sure to <em>test your code in browsers that do and don't support strict mode</em>. If you test only in browsers that don't support strict mode, you're very likely to have problems in browsers that do, and vice versa.</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-10.1.1', 'Strict Mode Code')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Initial definition. See also: <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-C">Strict mode restriction and exceptions</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-strict-mode-code', 'Strict Mode Code')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td><a href="http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-of-ecmascript">Strict mode restriction and exceptions</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-strict-mode-code', 'Strict Mode Code')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td><a href="https://tc39.github.io/ecma262/#sec-strict-mode-of-ecmascript">Strict mode restriction and exceptions</a></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a class="external" href="http://whereswalden.com/2010/09/08/new-es5-strict-mode-support-now-with-poison-pills/" title="http://whereswalden.com/2010/09/08/new-es5-strict-mode-support-now-with-poison-pills/">Where's Walden? » New ES5 strict mode support: now with poison pills!</a></li>
+ <li><a class="external" href="http://whereswalden.com/2011/01/24/new-es5-strict-mode-requirement-function-statements-not-at-top-level-of-a-program-or-function-are-prohibited/" title="http://whereswalden.com/2011/01/24/new-es5-strict-mode-requirement-function-statements-not-at-top-level-of-a-program-or-function-are-prohibited/">Where's Walden? » New ES5 strict mode requirement: function statements not at top level of a program or function are prohibited</a></li>
+ <li><a class="external" href="http://whereswalden.com/2011/01/10/new-es5-strict-mode-support-new-vars-created-by-strict-mode-eval-code-are-local-to-that-code-only/" title="http://whereswalden.com/2011/01/10/new-es5-strict-mode-support-new-vars-created-by-strict-mode-eval-code-are-local-to-that-code-only/">Where's Walden? » New ES5 strict mode support: new vars created by strict mode eval code are local to that code only</a></li>
+ <li><a href="http://qnimate.com/javascript-strict-mode-in-nutshell/">JavaScript "use strict" tutorial for beginners.</a></li>
+ <li><a class="external" href="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/" title="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/">John Resig - ECMAScript 5 Strict Mode, JSON, and More</a></li>
+ <li><a class="external" href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/">ECMA-262-5 in detail. Chapter 2. Strict Mode.</a></li>
+ <li><a class="external" href="http://kangax.github.io/compat-table/es5/#Strict_mode">Strict mode compatibility table</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode">Transitioning to strict mode</a></li>
+</ul>
diff --git a/files/zh-tw/web/javascript/reference/template_literals/index.html b/files/zh-tw/web/javascript/reference/template_literals/index.html
new file mode 100644
index 0000000000..9ed8da0437
--- /dev/null
+++ b/files/zh-tw/web/javascript/reference/template_literals/index.html
@@ -0,0 +1,252 @@
+---
+title: 樣板字面值
+slug: Web/JavaScript/Reference/Template_literals
+tags:
+ - ECMAScript 2015
+ - Guide
+ - JavaScript
+ - String
+ - Template Strings
+ - Template literals
+ - Template string
+ - strings
+translation_of: Web/JavaScript/Reference/Template_literals
+---
+<div>{{JsSidebar("More")}}</div>
+
+<p>樣板字面值(Template literals)是允許嵌入運算式的字串字面值(string literals)。你可以透過樣板字面值來使用多行字串及字串內插(string interpolation)功能。他們在 ES2015 規範的先行版本中被稱為「樣板字串(template strings)」。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">`string text`
+
+`string text line 1
+ string text line 2`
+
+`string text ${expression} string text`
+
+tag `string text ${expression} string text`
+</pre>
+
+<h2 id="描述">描述</h2>
+
+<p>樣板字面值(Template literals)被反引號(back-tick,<a href="https://zh.wikipedia.org/wiki/%E9%87%8D%E9%9F%B3%E7%AC%A6">重音符號</a>):` ` 字元封閉,代替了雙或單引號。樣板字面值可以包含由錢字元及花括號所構成(<code>${expression}</code>)的佔位符(placeholders)。這個在佔位符中的運算式以及在它們之間的文字會被傳入一個函式。預設函式只是將這些部分組合成一個單一的字串。如果在樣板字面值前有一個運算式(<code>tag</code> here),則此樣板字串被稱為「標籤樣板字面值(tagged template literal)」。在此情況下,標籤運算式(通常是一個函式)會被呼叫來處理樣板字面值,讓你可以在函式回傳之前進行操作。要在樣板字面值中跳脫一個反引號,可以於反引號前加上一個反斜線(backslash)<strong>\ </strong>。</p>
+
+<pre class="brush: js">`\`` === '`' // --&gt; true</pre>
+
+<h3 id="多行字串">多行字串</h3>
+
+<p>任何在樣板字面值中使用、插入的換行符號,都是樣板字面值的一部份。在普通的字串中,我們需要使用如下的語法以達到換行的效果:</p>
+
+<pre class="brush: js">console.log('string text line 1\n' +
+'string text line 2');
+// "string text line 1
+// string text line 2"</pre>
+
+<p>但使用樣板字面值,你只需要撰寫如下所示的程式碼,就能達到同樣的效果:</p>
+
+<pre class="brush: js">console.log(`string text line 1
+string text line 2`);
+// "string text line 1
+// string text line 2"</pre>
+
+<h3 id="運算式內插">運算式內插</h3>
+
+<p>要在普通的字串中內嵌運算式,我們必須使用如下語法:</p>
+
+<pre class="brush: js">var a = 5;
+var b = 10;
+console.log('Fifteen is ' + (a + b) + ' and\nnot ' + (2 * a + b) + '.');
+// "Fifteen is 15 and
+// not 20."</pre>
+
+<p>現在有了樣板字面值,我們可以用一種更優雅的寫法,讓語法更具可讀性:</p>
+
+<pre class="brush: js">var a = 5;
+var b = 10;
+console.log(`Fifteen is ${a + b} and
+not ${2 * a + b}.`);
+// "Fifteen is 15 and
+// not 20."</pre>
+
+<h3 id="巢狀樣板">巢狀樣板</h3>
+
+<p>In certain times, nesting a template is the easiest and perhaps more readable way to have configurable strings. Within a backticked template it is simple to allow inner backticks simply by using them inside a placeholder <code>${ }</code> within the template. For instance, if condition a is true: then return this templated literal.</p>
+
+<p>In ES5:</p>
+
+<pre class="brush: js">var classes = 'header'
+classes += (isLargeScreen() ?
+  '' : item.isCollapsed ?
+  ' icon-expander' : ' icon-collapser');
+</pre>
+
+<p>In ES2015 with template literals and without nesting:</p>
+
+<pre class="brush: js">const classes = `header ${ isLargeScreen() ? '' :
+  (item.isCollapsed ? 'icon-expander' : 'icon-collapser') }`;</pre>
+
+<p>In ES2015 with nested template literals:</p>
+
+<pre class="brush: js">const classes = `header $<strong>{</strong> isLargeScreen() ? '' :
+ `icon-${item.isCollapsed ? 'expander' : 'collapser'}`<strong> </strong><strong>}`</strong>;</pre>
+
+<h3 id="標籤樣板字面值">標籤樣板字面值</h3>
+
+<p>標籤樣板字面值是一種更高級的樣板字面值形式,允許你透過標籤函數操作樣板字面值的輸出。標籤函數的第一個參數是一字串陣列,其餘參數則是處理過的表達式。最終,你可以返回一個經處理後的字串,甚至是完全不一樣的東西(如下述第二個範例中)。標籤函數的名稱可以是任何你想要的。</p>
+
+<pre class="brush: js">var person = 'Mike';
+var age = 28;
+
+function myTag(strings, personExp, ageExp) {
+
+ var str0 = strings[0]; // "that "
+ var str1 = strings[1]; // " is a "
+
+ // There is technically a string after
+ // the final expression (in our example),
+ // but it is empty (""), so disregard.
+ // var str2 = strings[2];
+
+ var ageStr;
+ if (ageExp &gt; 99){
+ ageStr = 'centenarian';
+ } else {
+ ageStr = 'youngster';
+ }
+
+ return str0 + personExp + str1 + ageStr;
+
+}
+
+var output = myTag`that ${ person } is a ${ age }`;
+
+console.log(output);
+// that Mike is a youngster</pre>
+
+<p>標籤函數不一定要回傳一個字串,如下列範例:</p>
+
+<pre class="brush: js">function template(strings, ...keys) {
+ return (function(...values) {
+ var dict = values[values.length - 1] || {};
+ var result = [strings[0]];
+ keys.forEach(function(key, i) {
+ var value = Number.isInteger(key) ? values[key] : dict[key];
+ result.push(value, strings[i + 1]);
+ });
+ return result.join('');
+ });
+}
+
+var t1Closure = template`${0}${1}${0}!`;
+t1Closure('Y', 'A'); // "YAY!"
+var t2Closure = template`${0} ${'foo'}!`;
+t2Closure('Hello', {foo: 'World'}); // "Hello World!"
+</pre>
+
+<h3 id="原始字串">原始字串</h3>
+
+<p>標籤函數的第一個參數,帶有一個特殊的屬性「 <code>raw</code> 」,允許你獲取原始輸入的、未處理任何<a href="/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Using_special_characters_in_strings">轉義序列</a>的字串值。</p>
+
+<pre class="brush: js">function tag(strings) {
+ console.log(strings.raw[0]);
+}
+
+tag`string text line 1 \n string text line 2`;
+// logs "string text line 1 \n string text line 2" ,
+// including the two characters '\' and 'n'
+</pre>
+
+<p>此外, 使用 {{jsxref("String.raw()")}} 方法建立的原始字串,也與預設的樣板函數和字串串接會建立的字串相同。 </p>
+
+<pre class="brush: js">var str = String.raw`Hi\n${2+3}!`;
+// "Hi\n5!"
+
+str.length;
+// 6
+
+str.split('').join(',');
+// "H,i,\,n,5,!"
+</pre>
+
+<h3 id="標籤樣板字面值和跳脫序列">標籤樣板字面值和跳脫序列</h3>
+
+<p>在 ES2016 的規範中,標籤樣板字面值遵守下列跳脫序列(escape sequences)規則:</p>
+
+<ul>
+ <li>萬國碼 (Unicode) 跳脫序列由 "\u" 作為開頭, 例: <code>\u00A9</code></li>
+ <li>萬國碼位 (Unicode code point) 由 "\u{}" 作為開頭, 例: <code>\u{2F804}</code></li>
+ <li>十六進位制碼由 "\x" 作為開頭, 例: <code>\xA9</code></li>
+ <li>十進位制碼由 "\" 作為開頭, 例: \251</li>
+</ul>
+
+<p>這表示像是下述的標籤樣板字面值是有問題的,因為根據 ECMAScript 規範,一個語法分析器會嘗試以萬國碼轉義序列去解析它,然後發現序列有誤:</p>
+
+<pre class="brush: js">latex`\unicode`
+// Throws in older ECMAScript versions (ES2016 and earlier)
+// SyntaxError: malformed Unicode character escape sequence</pre>
+
+<p>Tagged template literals should allow the embedding of languages (for example <a href="https://en.wikipedia.org/wiki/Domain-specific_language">DSLs</a>, or <a href="https://en.wikipedia.org/wiki/LaTeX">LaTeX</a>), where other escapes sequences are common. The ECMAScript proposal <a href="https://tc39.github.io/proposal-template-literal-revision/">Template Literal Revision</a> (stage 4, to be integrated in the ECMAScript 2018 standard) removes the syntax restriction of ECMAScript escape sequences from tagged template literals.</p>
+
+<p>However, illegal escape sequence must still be represented in the "cooked" representation. They will show up as {{jsxref("undefined")}} element in the "cooked" array:</p>
+
+<p>l be represented in the "cooked" representation. They will show up as {{jsxref("undefined")}} element in the "cooked" array:</p>
+
+<p> </p>
+
+<pre class="brush: js">function latex(str) {
+ return { "cooked": str[0], "raw": str.raw[0] }
+}
+
+latex`\unicode`
+
+// { cooked: undefined, raw: "\\unicode" }</pre>
+
+<p>Note that the escape sequence restriction is only dropped from <em>tagged</em> template literals and not from <em>untagged</em> template literals:</p>
+
+<pre class="brush: js example-bad">let bad = `bad escape sequence: \unicode`;</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-template-literals', 'Template Literals')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition. Defined in several section of the specification: <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-template-literals">Template Literals</a>, <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-tagged-templates">Tagged Templates</a></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-template-literals', 'Template Literals')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Defined in several section of the specification: <a href="https://tc39.github.io/ecma262/#sec-template-literals">Template Literals</a>, <a href="https://tc39.github.io/ecma262/#sec-tagged-templates">Tagged Templates</a></td>
+ </tr>
+ <tr>
+ <td><a href="https://tc39.github.io/proposal-template-literal-revision/">Template Literal Revision</a></td>
+ <td>Stage 4 draft</td>
+ <td>Drops escape sequence restriction from tagged template literals</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.grammar.template_literals")}}</p>
+</div>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{jsxref("String")}}</li>
+ <li>{{jsxref("String.raw()")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Reference/Lexical_grammar">Lexical grammar</a></li>
+ <li><a href="https://gist.github.com/WebReflection/8f227532143e63649804">Template-like strings in ES3 compatible syntax</a></li>
+ <li><a href="https://hacks.mozilla.org/2015/05/es6-in-depth-template-strings-2/">"ES6 in Depth: Template strings" on hacks.mozilla.org</a></li>
+</ul>