-
Notifications
You must be signed in to change notification settings - Fork 68
/
x15.4.html
3143 lines (3138 loc) · 115 KB
/
x15.4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="split chapter"><head><meta charset="utf-8"><title>15.4 Array Objects # Ⓣ Ⓔ ① Ⓐ — Annotated ES5</title><link rel="stylesheet" href="style.css"><link href="x15.3.html" title="15.3 Function Objects " rel="prev">
<link href="spec.html" title="TOC" rel="index">
<link href="x15.5.html" title="15.5 String Objects " rel="next">
</head><body><div class="head">
<h2 id="top">Annotated ECMAScript 5.1 <span id="timestamp"></span></h2>
<div id="mascot-treehouse">
<img id="mascot" align="left" src="js-mascot.svg" alt=""><img id="bubble" src="bubble.svg" alt=""></div>
<p id="slogan">‟Ex igne vita”</p>
<div id="annotations"></div>
<script src="timestamp.js"></script></div>
<nav>
<a href="x15.3.html">← 15.3 Function Objects </a> –
<a href="spec.html" class="toc-nav">TOC</a> –
<a href="x15.5.html">15.5 String Objects →</a>
<ol class="toc"><li><ol><li><a href="x15.4.html#x15.4" id="x15.4-toc">15.4 Array Objects</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.1" id="x15.4.1-toc">15.4.1 The Array Constructor Called as a Function</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.1.1" id="x15.4.1.1-toc">15.4.1.1 Array ( [ item1 [ , item2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li><li><a href="x15.4.html#x15.4.2" id="x15.4.2-toc">15.4.2 The Array Constructor</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.2.1" id="x15.4.2.1-toc">15.4.2.1 new Array ( [ item0 [ , item1 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.2.2" id="x15.4.2.2-toc">15.4.2.2 new Array (len)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li><li><a href="x15.4.html#x15.4.3" id="x15.4.3-toc">15.4.3 Properties of the Array Constructor</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.3.1" id="x15.4.3.1-toc">15.4.3.1 Array.prototype</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.3.2" id="x15.4.3.2-toc">15.4.3.2 Array.isArray ( arg )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li><li><a href="x15.4.html#x15.4.4" id="x15.4.4-toc">15.4.4 Properties of the Array Prototype Object</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.4.1" id="x15.4.4.1-toc">15.4.4.1 Array.prototype.constructor</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.2" id="x15.4.4.2-toc">15.4.4.2 Array.prototype.toString ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.3" id="x15.4.4.3-toc">15.4.4.3 Array.prototype.toLocaleString ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.4" id="x15.4.4.4-toc">15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.5" id="x15.4.4.5-toc">15.4.4.5 Array.prototype.join (separator)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.6" id="x15.4.4.6-toc">15.4.4.6 Array.prototype.pop ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.7" id="x15.4.4.7-toc">15.4.4.7 Array.prototype.push ( [ item1 [ , item2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.8" id="x15.4.4.8-toc">15.4.4.8 Array.prototype.reverse ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.9" id="x15.4.4.9-toc">15.4.4.9 Array.prototype.shift ( )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.10" id="x15.4.4.10-toc">15.4.4.10 Array.prototype.slice (start, end)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.11" id="x15.4.4.11-toc">15.4.4.11 Array.prototype.sort (comparefn)</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.12" id="x15.4.4.12-toc">15.4.4.12 Array.prototype.splice (start, deleteCount [ , item1 [ , item2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.13" id="x15.4.4.13-toc">15.4.4.13 Array.prototype.unshift ( [ item1 [ , item2 [ , … ] ] ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.14" id="x15.4.4.14-toc">15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.15" id="x15.4.4.15-toc">15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.16" id="x15.4.4.16-toc">15.4.4.16 Array.prototype.every ( callbackfn [ , thisArg ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.17" id="x15.4.4.17-toc">15.4.4.17 Array.prototype.some ( callbackfn [ , thisArg ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.18" id="x15.4.4.18-toc">15.4.4.18 Array.prototype.forEach ( callbackfn [ , thisArg ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.19" id="x15.4.4.19-toc">15.4.4.19 Array.prototype.map ( callbackfn [ , thisArg ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.20" id="x15.4.4.20-toc">15.4.4.20 Array.prototype.filter ( callbackfn [ , thisArg ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.21" id="x15.4.4.21-toc">15.4.4.21 Array.prototype.reduce ( callbackfn [ , initialValue ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.4.22" id="x15.4.4.22-toc">15.4.4.22 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li><li><a href="x15.4.html#x15.4.5" id="x15.4.5-toc">15.4.5 Properties of Array Instances</a>
<b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> <ol><li><a href="x15.4.html#x15.4.5.1" id="x15.4.5.1-toc">15.4.5.1 [[DefineOwnProperty]] ( P, Desc, Throw )</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li><li><a href="x15.4.html#x15.4.5.2" id="x15.4.5.2-toc">15.4.5.2 length</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b> </li></ol></li></ol></li></ol></li></ol></nav>
<h3 id="x15.4" class="splitme">15.4 Array Objects <a href="#x15.4">#</a> <a href="#x15.4-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h3>
<p>
Array
objects give special treatment to a certain class of property names.
A property name <i>P</i>
(in the form of a String value) is an <i>array index</i> if and only
if <a href="x9.html#x9.8">ToString</a>(<a href="x9.html#x9.6">ToUint32</a>(<i>P</i>))
is equal to <i>P</i> and
<a href="x9.html#x9.6">ToUint32</a>(<i>P</i>)
is not equal to 2<sup>32</sup><span class="symbol">−</span>1.
A property whose property name is an array index is also called an
<dfn id="array-element"><i>element</i></dfn>. Every Array object has a <code><b>length</b></code>
property whose value is always a nonnegative integer less than 2<sup>32</sup>.
The value of the <code><b>length</b></code>
property is numerically greater than the name of every property
whose name is an array index; whenever a property of an Array object
is created or changed, other properties are adjusted as necessary to
maintain this invariant. Specifically, whenever a property is added
whose name is an array index, the <code><b>length</b></code>
property is changed, if necessary, to be one more than the numeric
value of that array index; and whenever the <code><b>length</b></code>
property is changed, every property whose name is an array index
whose value is not smaller than the new length is automatically
deleted. This constraint applies only to own properties of an Array
object and is unaffected by <code><b>length</b></code>
or array index properties that may be inherited from its prototypes.</p>
<p>
An
object, <i>O</i>, is
said to be <dfn id="sparse"><i>sparse</i></dfn> if the following algorithm returns <b>true</b>:</p>
<ol><li><p class="sm-btm">
Let
<i>len</i>
be the result of calling the [[Get]] internal method of <i>O</i>
with argument <b>"length"</b>.</p>
</li>
<li><p class="sm-btm">
For
each integer <i>i</i>
in the range 0≤<i>i</i><<a href="x9.html#x9.6">ToUint32</a>(<i>len</i>)</p>
<ol><li><p class="sm-btm">
Let
<i>elem</i>
be the result of calling the [[GetOwnProperty]] internal method of
<i>O</i>
with argument <a href="x9.html#x9.8">ToString</a>(<i>i</i>).</p>
</li>
<li><p class="sm-btm">
If
<i>elem</i>
is <b>undefined</b>,
return <b>true</b>.</p>
</li></ol></li>
<li><p class="sm-btm">
Return
<b>false</b>.</p>
</li></ol><h4 id="x15.4.1">15.4.1 The Array Constructor Called as a Function <a href="#x15.4.1">#</a> <a href="#x15.4.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<p>
When
<code><b>Array</b></code> is called as
a function rather than as a constructor, it creates and initialises
a new Array object. Thus the function call <code><b>Array(</b></code><code>…</code><code><b>)</b></code>
is equivalent to the object creation expression <code><b>new Array(</b></code><code>…</code><code><b>)</b></code>
with the same arguments.</p>
<h5 id="x15.4.1.1">15.4.1.1 Array ( [ item1 [ , item2 [ , … ] ] ] ) <a href="#x15.4.1.1">#</a> <a href="#x15.4.1.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
When
the <code><b>Array</b></code> function
is called the following steps are taken:</p>
<ol><li><p>
Create
and return a new Array object exactly as if the standard built-in
constructor <code><b>Array</b></code>
was used in a <code><b>new</b></code>
expression with the same arguments (<a href="#x15.4.2">15.4.2</a>).</p>
</li></ol><h4 id="x15.4.2">15.4.2 The Array Constructor <a href="#x15.4.2">#</a> <a href="#x15.4.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<p>
When
<code><b>Array</b></code> is called as
part of a <code><b>new</b></code>
expression, it is a constructor: it initialises the newly created
object.</p>
<h5 id="x15.4.2.1">15.4.2.1 new Array ( [ item0 [ , item1 [ , … ] ] ] ) <a href="#x15.4.2.1">#</a> <a href="#x15.4.2.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
This
description applies if and only if the Array constructor is given no
arguments or at least two arguments.</p>
<p>
The
[[Prototype]] internal property of the newly constructed object is
set to the original Array prototype object, the one that is the
initial value of <code><b>Array.prototype</b></code>
(<a href="#x15.4.3.1">15.4.3.1</a>).</p>
<p>
The
[[Class]] internal property of the newly constructed object is set
to <code><b>"Array"</b></code>.</p>
<p>
The
[[Extensible]] internal property of the newly constructed object is
set to <b>true</b>.</p>
<p>
The
<code><b>length</b></code> property of
the newly constructed object is set to the number of arguments.</p>
<p>
The <code><b>0</b></code>
property of the newly constructed object is set to <i>item0</i>
(if supplied); the <code><b>1</b></code>
property of the newly constructed object is set to <i>item1</i>
(if supplied); and, in general, for as many arguments as there are,
the <i>k</i> property of
the newly constructed object is set to argument <i>k</i>,
where the first argument is considered to be argument number <code><b>0</b></code>.
These properties all have the attributes {[[Writable]]: <b>true</b>,
[[Enumerable]]: <b>true</b>, [[Configurable]]: <b>true</b>}.</p>
<h5 id="x15.4.2.2">15.4.2.2 new Array (len) <a href="#x15.4.2.2">#</a> <a href="#x15.4.2.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
[[Prototype]] internal property of the newly constructed object is
set to the original Array prototype object, the one that is the
initial value of <code><b>Array.prototype</b></code>
(<a href="#x15.4.3.1">15.4.3.1</a>). The [[Class]] internal property of the newly constructed
object is set to <code><b>"Array"</b></code>.
The [[Extensible]] internal property of the newly constructed object
is set to <b>true</b>.</p>
<p>
If
the argument <i>len</i>
is a Number and <a href="x9.html#x9.6">ToUint32</a>(<i>len</i>)
is equal to <i>len</i>,
then the <code><b>length</b></code>
property of the newly constructed object is set to <a href="x9.html#x9.6">ToUint32</a>(<i>len</i>).
If the argument <i>len</i>
is a Number and <a href="x9.html#x9.6">ToUint32</a>(<i>len</i>)
is not equal to <i>len</i>,
a <b><a href="x15.11.html#x15.11.6.2" class="term-ref">RangeError</a></b> exception is thrown.</p>
<p>
If
the argument <i>len</i>
is not a Number, then the <code><b>length</b></code>
property of the newly constructed object is set to <code><b>1</b></code>
and the <code><b>0</b></code> property
of the newly constructed object is set to <i>len</i>
with attributes {[[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>,
[[Configurable]]: <b>true</b>}..</p>
<h4 id="x15.4.3">15.4.3 Properties of the Array Constructor <a href="#x15.4.3">#</a> <a href="#x15.4.3-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<p>
The
value of the [[Prototype]] internal property of the Array
constructor is the Function prototype object (<a href="x15.3.html#x15.3.4">15.3.4</a>).</p>
<p>
Besides
the internal properties and the <code><b>length</b></code>
property (whose value is <b>1</b>), the Array constructor has the
following properties:</p>
<h5 id="x15.4.3.1">15.4.3.1 Array.prototype <a href="#x15.4.3.1">#</a> <a href="#x15.4.3.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
initial value of <code><b>Array.prototype</b></code>
is the Array prototype object (<a href="#x15.4.4">15.4.4</a>).</p>
<p>
This
property has the attributes { [[Writable]]: <b>false</b>,
[[Enumerable]]: <b>false</b>, [[Configurable]]: <b>false</b> }.</p>
<h5 id="x15.4.3.2">15.4.3.2 Array.isArray ( arg ) <a href="#x15.4.3.2">#</a> <a href="#x15.4.3.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
isArray function takes one argument <i>arg</i>,
and returns the Boolean value <b>true </b>if the argument is an
object whose class internal property is <code><b>"Array"</b></code>;
otherwise it returns <b>false</b>. The following steps are taken:</p>
<ol><li><p>
If
<a href="x8.html#Type">Type</a>(<i>arg</i>) is not Object, return <b>false</b>.</p>
</li>
<li><p>
If
the value of the [[Class]] internal property of <i>arg </i>is
<code><b>"Array"</b></code>,
then return <b>true</b>.</p>
</li>
<li><p>
Return
<b>false</b>.</p>
</li></ol><h4 id="x15.4.4">15.4.4 Properties of the Array Prototype Object <a href="#x15.4.4">#</a> <a href="#x15.4.4-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h4>
<p>
The
value of the [[Prototype]] internal property of the Array prototype
object is the standard built-in Object prototype object (<a href="x15.2.html#x15.2.4">15.2.4</a>).</p>
<p>
The
Array prototype object is itself an array; its [[Class]] is <code><b>"Array"</b></code>,
and it has a <code><b>length</b></code>
property (whose initial value is <b>+0</b>) and the special
[[DefineOwnProperty]] internal method described in <a href="#x15.4.5.1">15.4.5.1</a>.</p>
<p>
In
following descriptions of functions that are properties of the Array
prototype object, the phrase “this object” refers to the object
that is the <b>this</b> value for the invocation of the function. It
is permitted for the <b>this</b> to be an object for which the value
of the [[Class]] internal property is not <code><b>"Array"</b></code>.</p>
<p><b class="note">NOTE</b> The
Array prototype object does not have a <code><b>valueOf</b></code>
property of its own; however, it inherits the <code><b>valueOf</b></code>
property from the standard built-in Object prototype Object.</p>
<h5 id="x15.4.4.1">15.4.4.1 Array.prototype.constructor <a href="#x15.4.4.1">#</a> <a href="#x15.4.4.1-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
initial value of <code><b>Array.prototype.constructor</b></code>
is the standard built-in <code><b>Array</b></code>
constructor.</p>
<h5 id="x15.4.4.2">15.4.4.2 Array.prototype.toString ( ) <a href="#x15.4.4.2">#</a> <a href="#x15.4.4.2-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
When
the <code><b>toString</b></code>
method is called, the following steps are taken:</p>
<ol><li><p>
Let
<i>array</i> be the result of calling <a href="x9.html#x9.9">ToObject</a> on the <b>this</b>
value.</p>
</li>
<li><p>
Let
<i>func</i> be the result of calling the [[Get]] internal method of
<i>array</i> with argument <code><b>"join"</b></code>.</p>
</li>
<li><p>
If
<a href="x9.html#x9.11">IsCallable</a>(<i>func</i>) is <b>false</b>, then let <i>func</i> be
the standard built-in method <a href="x15.2.html#x15.2.4.2">Object.prototype.toString</a> (<a href="x15.2.html#x15.2.4.2">15.2.4.2</a>).</p>
</li>
<li><p>
Return
the result of calling the [[Call]] internal method of <i>func</i>
providing <i>array</i> as the <b>this</b> value and an empty
arguments list.</p>
</li></ol><p class="sp">
</p><p><b class="note">NOTE</b> The <code><b>toString</b></code>
function is intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>toString</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.3">15.4.4.3 Array.prototype.toLocaleString ( ) <a href="#x15.4.4.3">#</a> <a href="#x15.4.4.3-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
<a href="#array-element">elements of the array</a> are converted to Strings using their
<code><b>toLocaleString</b></code>
methods, and these Strings are then concatenated, separated by
occurrences of a separator String that has been derived in an
implementation-defined locale-specific way. The result of calling
this function is intended to be analogous to the result of <code><b>toString</b></code>,
except that the result of this function is intended to be
locale-specific.</p>
<p>
The
result is calculated as follows:</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>arrayLen</i> be the result of calling the [[Get]] internal
method of <i>array</i> with argument <code><b>"length"</b></code>.</p>
</li>
<li><p>
Let
<i>len</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>arrayLen</i>).</p>
</li>
<li><p>
Let
<i>separator</i> be the String value for the list-separator String
appropriate for the host environment’s current locale (this is
derived in an implementation-defined way).</p>
</li>
<li><p>
If
<i>len</i> is zero, return the empty String.</p>
</li>
<li><p>
Let
<i>firstElement</i> be the result of calling the [[Get]] internal
method of <i>array</i> with argument <code><b>"0"</b></code>.</p>
</li>
<li><p>
If
<i>firstElement</i> is <b>undefined</b> or <b>null</b>, then</p>
<ol><li><p>
Let
<i>R</i> be the empty String.</p>
</li></ol></li>
<li><p>
Else
</p>
<ol><li><p>
Let
<i>elementObj</i> be <a href="x9.html#x9.9">ToObject</a>(<i>firstElement</i>).</p>
</li>
<li><p>
Let
<i>func</i> be the result of calling the [[Get]] internal method
of <i>elementObj</i> with argument <code><b>"toLocaleString"</b></code>.</p>
</li>
<li><p>
If
<a href="x9.html#x9.11">IsCallable</a>(<i>func</i>) is <b>false</b>, throw a <b><a href="x15.11.html#x15.11.6.5" class="term-ref">TypeError</a></b>
exception.</p>
</li>
<li><p>
Let
<i>R</i> be the result of calling the [[Call]] internal method of
<i>func</i> providing <i>elementObj</i> as the <b>this</b> value
and an empty arguments list.
</p>
</li></ol></li>
<li><p>
Let
<i>k</i> be <code><b>1</b></code>.</p>
</li>
<li><p>
Repeat,
while <i>k</i> < <i>len</i></p>
<ol><li><p>
Let
<i>S</i> be a String value produced by concatenating <i>R</i> and
<i>separator</i>.</p>
</li>
<li><p>
Let
<i>nextElement</i> be the result of calling the [[Get]] internal
method of <i>array</i> with argument <a href="x9.html#x9.8">ToString</a>(<i>k</i>).</p>
</li>
<li><p>
If
<i>nextElement</i> is <b>undefined</b> or <b>null</b>, then</p>
<ol><li><p>
Let
<i>R</i> be the empty String.</p>
</li></ol></li>
<li><p>
Else
</p>
<ol><li><p>
Let
<i>elementObj</i> be <a href="x9.html#x9.9">ToObject</a>(<i>nextElement</i>).</p>
</li>
<li><p>
Let
<i>func</i> be the result of calling the [[Get]] internal method
of <i>elementObj</i> with argument <code><b>"toLocaleString"</b></code>.</p>
</li>
<li><p>
If
<a href="x9.html#x9.11">IsCallable</a>(<i>func</i>) is <b>false</b>, throw a <b><a href="x15.11.html#x15.11.6.5" class="term-ref">TypeError</a></b>
exception.</p>
</li>
<li><p>
Let
<i>R</i> be the result of calling the [[Call]] internal method of
<i>func</i> providing <i>elementObj</i> as the <b>this</b> value
and an empty arguments list.
</p>
</li></ol></li>
<li><p>
Let
<i>R</i> be a String value produced by concatenating <i>S</i> and
<i>R</i>.</p>
</li>
<li><p>
Increase
<i>k</i> by 1.</p>
</li></ol></li>
<li><p>
Return
<i>R</i>.</p>
</li></ol><p class="sp"><b class="note">NOTE 1</b> The first parameter to this function is likely to be used in a
future version of this standard; it is recommended that
implementations do not use this parameter position for anything
else.</p>
<p><b class="note">NOTE 2</b> The <code><b>toLocaleString</b></code>
function is intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>toLocaleString</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.4">15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , … ] ] ] ) <a href="#x15.4.4.4">#</a> <a href="#x15.4.4.4-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
When
the <code><b>concat</b></code> method
is called with zero or more arguments <i>item1</i>,
<i>item2</i>, etc., it
returns an array containing the <a href="#array-element">array element</a>s of the object
followed by the <a href="#array-element">array element</a>s of each argument in order.</p>
<p>
The
following steps are taken:</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>A</i> be a new array created as if by the expression <code><b>new
Array()</b></code> where <code><b>Array</b></code>
is the standard built-in constructor with that name.</p>
</li>
<li><p>
Let
<i>n</i> be 0.</p>
</li>
<li><p>
Let
<i>items</i> be an internal <a href="x8.html#x8.8">List</a> whose first element is <i>O</i>
and whose subsequent elements are, in left to right order, the
arguments that were passed to this function invocation.</p>
</li>
<li><p>
Repeat,
while <i>items</i> is not empty</p>
<ol><li><p>
Remove
the first element from <i>items</i> and let <i>E</i> be the value
of the element.</p>
</li>
<li><p>
If
the value of the [[Class]] internal property of <i>E</i> is
<code><b>"Array"</b></code>,
then</p>
<ol><li><p>
Let
<i>k</i> be 0.</p>
</li>
<li><p>
Let
<i>len</i> be the result of calling the [[Get]] internal method
of <i>E</i> with argument <code><b>"length"</b></code>.</p>
</li>
<li><p>
Repeat,
while <i>k</i> < <i>len</i></p>
<ol><li><p>
Let
<i>P</i> be <a href="x9.html#x9.8">ToString</a>(<i>k</i>).</p>
</li>
<li><p>
Let
<i>exists</i> be the result of calling the [[HasProperty]]
internal method of <i>E</i> with <i>P</i>.</p>
</li>
<li><p>
If
<i>exists</i> is <b>true</b>, then</p>
<ol><li><p>
Let
<i>subElement</i> be the result of calling the [[Get]] internal
method of <i>E</i> with argument <i>P</i>.</p>
</li>
<li><p>
Call
the [[DefineOwnProperty]] internal method of <i>A</i> with
arguments <a href="x9.html#x9.8">ToString</a>(<i>n</i>), <a href="x8.html#x8.10">Property Descriptor</a> {[[Value]]:
<i>subElement</i>, [[Writable]]: <b>true</b>, [[Enumerable]]:
<b>true</b>, [[Configurable]]: <b>true</b>}, and <b>false</b>.</p>
</li></ol></li>
<li><p>
Increase
<i>n</i> by 1.</p>
</li>
<li><p>
Increase
<i>k</i> by 1.</p>
</li></ol></li></ol></li>
<li><p>
Else,
<i>E</i> is not an Array</p>
<ol><li><p>
Call
the [[DefineOwnProperty]] internal method of <i>A</i> with
arguments <a href="x9.html#x9.8">ToString</a>(<i>n</i>), <a href="x8.html#x8.10">Property Descriptor</a> {[[Value]]: <i>E</i>,
[[Writable]]: <b>true</b>, [[Enumerable]]: <b>true</b>,
[[Configurable]]: <b>true</b>}, and <b>false</b>.</p>
</li>
<li><p>
Increase
n by 1.</p>
</li></ol></li></ol></li>
<li><p>
Return
<i>A</i>.</p>
</li></ol><p>
The
<code><b>length</b></code> property of
the <code><b>concat</b></code> method
is <b>1</b>.</p>
<p><b class="note">NOTE</b> The
<code><b>concat</b></code> function is
intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>concat</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.5">15.4.4.5 Array.prototype.join (separator) <a href="#x15.4.4.5">#</a> <a href="#x15.4.4.5-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
<a href="#array-element">elements of the array</a> are converted to Strings, and these Strings
are then concatenated, separated by occurrences of the <i>separator</i>.
If no separator is provided, a single comma is used as the
separator.</p>
<p>
The
<code><b>join</b></code> method takes
one argument, <i>separator</i>,
and performs the following steps:</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>lenVal</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code><b>"length"</b></code>.</p>
</li>
<li><p>
Let
<i>len</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>lenVal</i>).</p>
</li>
<li><p>
If
<i>separator</i> is <b>undefined</b>, let <i>separator</i> be the
single-character String <code><b>","</b></code>.</p>
</li>
<li><p>
Let
<i>sep</i> be <a href="x9.html#x9.8">ToString</a>(<i>separator</i>).</p>
</li>
<li><p>
If
<i>len</i> is zero, return the empty String.</p>
</li>
<li><p>
Let
<i>element0</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <code><b>"0"</b></code>.</p>
</li>
<li><p>
If
<i>element0</i> is <b>undefined</b> or <b>null</b>, let <i>R</i> be
the empty String; otherwise, Let <i>R</i> be <a href="x9.html#x9.8">ToString</a>(<i>element0</i>).</p>
</li>
<li><p>
Let
<i>k</i> be <code><b>1</b></code>.</p>
</li>
<li><p>
Repeat,
while <i>k</i> < <i>len</i></p>
<ol><li><p>
Let
<i>S</i> be the String value produced by concatenating <i>R</i>
and <i>sep</i>.</p>
</li>
<li><p>
Let
<i>element</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <a href="x9.html#x9.8">ToString</a>(<i>k</i>).</p>
</li>
<li><p>
If
<i>element</i> is <b>undefined</b> or <b>null</b>, Let <i>next</i>
be the empty String; otherwise, let <i>next</i> be
<a href="x9.html#x9.8">ToString</a>(<i>element</i>).</p>
</li>
<li><p>
Let
<i>R</i> be a String value produced by concatenating <i>S</i> and
<i>next</i>.</p>
</li>
<li><p>
Increase
<i>k</i> by 1.</p>
</li></ol></li>
<li><p>
Return
<i>R</i>.</p>
</li></ol><p>
The
<code><b>length</b></code> property of
the <code><b>join</b></code> method is
<b>1</b>.</p>
<p><b class="note">NOTE</b> The
<code><b>join</b></code> function is
intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore, it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>join</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.6">15.4.4.6 Array.prototype.pop ( ) <a href="#x15.4.4.6">#</a> <a href="#x15.4.4.6-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
last <a href="#array-element">element of the array</a> is removed from the array and returned.</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>lenVal</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code>"</code><code><b>length</b></code><code>"</code>.</p>
</li>
<li><p>
Let
<i>len</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>lenVal</i>).</p>
</li>
<li><p>
If
<i>len</i> is zero,
</p>
<ol><li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <code>"</code><code><b>length</b></code><code>"</code>,
0, and <b>true</b>.</p>
</li>
<li><p>
Return
<b>undefined</b>.</p>
</li></ol></li>
<li><p>
Else,
<i>len</i> > 0</p>
<ol><li><p>
Let
<i>indx</i> be <a href="x9.html#x9.8">ToString</a>(<i>len</i>–1).</p>
</li>
<li><p>
Let
<i>element</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <i>indx</i>.</p>
</li>
<li><p>
Call
the [[Delete]] internal method of <i>O</i> with arguments <i>indx</i>
and <b>true</b>.</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <code>"</code><code><b>length</b></code><code>"</code>,
<i>indx</i>, and <b>true</b>.</p>
</li>
<li><p>
Return
<i>element</i>.</p>
</li></ol></li></ol><p><b class="note">NOTE</b> The
<code><b>pop</b></code> function is
intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>pop</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.7">15.4.4.7 Array.prototype.push ( [ item1 [ , item2 [ , … ] ] ] ) <a href="#x15.4.4.7">#</a> <a href="#x15.4.4.7-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
arguments are appended to the end of the array, in the order in
which they appear. The new length of the array is returned as the
result of the call.</p>
<p>
When
the <code><b>push</b></code> method is
called with zero or more arguments <i>item1</i>,<i>item2</i>, etc., the following steps are taken:</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>lenVal</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code>"</code><code><b>length</b></code><code>"</code>.</p>
</li>
<li><p>
Let
<i>n</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>lenVal</i>).</p>
</li>
<li><p>
Let
<i>items</i> be an internal <a href="x8.html#x8.8">List</a> whose elements are, in left to
right order, the arguments that were passed to this function
invocation.</p>
</li>
<li><p>
Repeat,
while <i>items</i> is not empty</p>
<ol><li><p>
Remove
the first element from <i>items</i> and let <i>E</i> be the value
of the element.</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments
<a href="x9.html#x9.8">ToString</a>(<i>n</i>), <i>E</i>, and <b>true</b>.</p>
</li>
<li><p>
Increase
<i>n</i> by 1.</p>
</li></ol></li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <code>"</code><code><b>length</b></code><code>"</code>,
<i>n</i>, and <b>true</b>.</p>
</li>
<li><p>
Return
<i>n</i>.</p>
</li></ol><p>
The
<code><b>length</b></code> property of
the <code><b>push</b></code> method is
<b>1</b>.</p>
<p><b class="note">NOTE</b> The
<code><b>push</b></code> function is
intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>push</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.8">15.4.4.8 Array.prototype.reverse ( ) <a href="#x15.4.4.8">#</a> <a href="#x15.4.4.8-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
<a href="#array-element">elements of the array</a> are rearranged so as to reverse their order.
The object is returned as the result of the call.</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>lenVal</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code><b>"length"</b></code>.</p>
</li>
<li><p>
Let
<i>len</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>lenVal</i>).</p>
</li>
<li><p>
Let
<i>middle</i> be <a href="x5.html#floor">floor</a>(<i>len</i>/2).</p>
</li>
<li><p>
Let<i>lower</i> be <b>0</b>.</p>
</li>
<li><p>
Repeat,
while <i>lower</i> <span class="symbol">≠</span> <i>middle</i></p>
<ol><li><p>
Let
<i>upper</i> be <i>len</i><span class="symbol">−</span><i>lower</i> <span class="symbol">−</span>1.</p>
</li>
<li><p>
Let
<i>upperP</i> be <a href="x9.html#x9.8">ToString</a>(<i>upper</i>).</p>
</li>
<li><p>
Let
<i>lowerP</i> be <a href="x9.html#x9.8">ToString</a>(<i>lower</i>).</p>
</li>
<li><p>
Let
<i>lowerValue</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <i> lowerP</i>.</p>
</li>
<li><p>
Let
<i>upperValue</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <i>upperP</i> .</p>
</li>
<li><p>
Let
<i>lowerExists</i> be the result of calling the [[HasProperty]]
internal method of <i>O</i> with argument <i>lowerP</i>.</p>
</li>
<li><p>
Let
<i>upperExists</i> be the result of calling the [[HasProperty]]
internal method of <i>O</i> with argument <i>upperP</i>.</p>
</li>
<li><p>
If
<i>lowerExists</i> is <b>true</b> and <i>upperExists</i> is <b>true</b>,
then</p>
<ol><li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <i>lowerP</i>,
<i>upperValue</i>, and <b>true</b> .</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <i>upperP</i>,
<i>lowerValue</i>, and <b>true</b> .</p>
</li></ol></li>
<li><p>
Else
if <i>lowerExists</i> is <b>false</b> and <i>upperExists</i> is
<b>true</b>, then</p>
<ol><li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <i>lowerP</i>,
<i>upperValue</i>, and <b>true</b> .</p>
</li>
<li><p>
Call
the [[Delete]] internal method of <i>O</i>, with arguments <i>upperP</i>
and <b>true</b>.</p>
</li></ol></li>
<li><p>
Else
if <i>lowerExists</i> is <b>true</b> and <i>upperExists</i> is
<b>false</b>, then</p>
<ol><li><p>
Call
the [[Delete]] internal method of <i>O</i>, with arguments <i>lowerP</i>
and <b>true</b> .</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <i>upperP</i>,
<i>lowerValue</i>, and <b>true</b> .</p>
</li></ol></li>
<li><p>
Else,
both <i>lowerExists</i> and <i>upperExists</i> are <b>false</b></p>
<ol><li><p>
No
action is required.</p>
</li></ol></li>
<li><p>
Increase
<i>lower</i> by 1.</p>
</li></ol></li>
<li><p>
Return
<i>O</i> .</p>
</li></ol><p><b class="note">NOTE</b> The
<code><b>reverse</b></code> function
is intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore, it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>reverse</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.9">15.4.4.9 Array.prototype.shift ( ) <a href="#x15.4.4.9">#</a> <a href="#x15.4.4.9-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
first <a href="#array-element">element of the array</a> is removed from the array and returned.</p>
<ol><li><p>
Let
<i>O </i>be the result of calling <a href="x9.html#x9.9">ToObject</a> passing the <b>this
</b>value as the argument.</p>
</li>
<li><p>
Let
<i>lenVal</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code>"</code><code><b>length</b></code><code>"</code>.</p>
</li>
<li><p>
Let
<i>len</i> be <a href="x9.html#x9.6">ToUint32</a>(<i>lenVal</i>).</p>
</li>
<li><p>
If
<i>len</i> is zero, then</p>
<ol><li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <code>"</code><code><b>length</b></code><code>"</code>,
0, and <b>true</b>.</p>
</li>
<li><p>
Return
<b>undefined</b>.</p>
</li></ol></li>
<li><p>
Let
<i>first</i> be the result of calling the [[Get]] internal method
of <i>O</i> with argument <code>"</code><code><b>0</b></code><code>"</code>.</p>
</li>
<li><p>
Let
<i>k</i> be 1.</p>
</li>
<li><p>
Repeat,
while <i>k</i> < <i>len</i></p>
<ol><li><p>
Let
<i>from</i> be <a href="x9.html#x9.8">ToString</a>(<i>k</i>).</p>
</li>
<li><p>
Let
<i>to</i> be <a href="x9.html#x9.8">ToString</a>(<i>k</i>–1).</p>
</li>
<li><p>
Let
<i>fromPresent</i> be the result of calling the [[HasProperty]]
internal method of <i>O</i> with argument <i>from</i>.</p>
</li>
<li><p>
If
<i>fromPresent</i> is <b>true</b>, then</p>
<ol><li><p>
Let
<i>fromVal</i> be the result of calling the [[Get]] internal
method of <i>O</i> with argument <i>from</i>.</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <i>to</i>,
<i>fromVal</i>, and <b>true</b>.</p>
</li></ol></li>
<li><p>
Else,
fromPresent is <b>false</b></p>
<ol><li><p>
Call
the [[Delete]] internal method of <i>O</i> with arguments <i>to</i>
and <b>true</b>.</p>
</li></ol></li>
<li><p>
Increase
<i>k</i> by 1.</p>
</li></ol></li>
<li><p>
Call
the [[Delete]] internal method of <i>O</i> with arguments
<a href="x9.html#x9.8">ToString</a>(<i>len</i>–1) and <b>true</b>.</p>
</li>
<li><p>
Call
the [[Put]] internal method of <i>O</i> with arguments <code>"</code><code><b>length</b></code><code>"</code>,
(<i>len</i>–1) , and <b>true</b>.</p>
</li>
<li><p>
Return
<i>first</i>.</p>
</li></ol><p><b class="note">NOTE</b> The
<code><b>shift</b></code> function is
intentionally generic; it does not require that its <b>this</b>
value be an Array object. Therefore it can be transferred to other
kinds of objects for use as a method. Whether the <code><b>shift</b></code>
function can be applied successfully to a host object is
implementation-dependent.</p>
<h5 id="x15.4.4.10">15.4.4.10 Array.prototype.slice (start, end) <a href="#x15.4.4.10">#</a> <a href="#x15.4.4.10-toc" class="bak">Ⓣ</a> <b class="erra">Ⓔ</b> <b class="rev1">①</b> <b class="anno">Ⓐ</b></h5>
<p>
The
<code><b>slice</b></code> method takes
two arguments, <i>start</i>
and <i>end</i>, and
returns an array containing the <a href="#array-element">elements of the array</a> from element
<i>start</i> up to, but
not including, element <i>end</i>
(or through the end of the array if <i>end</i>
is <b>undefined</b>). If <i>start</i>
is negative, it is treated as <i>length</i>+<i>start</i>
where <i>length</i> is
the length of the array. If <i>end</i>
is negative, it is treated as <i>length</i>+<i>end</i>
where <i>length</i>
is the length of the array. The following steps are taken:</p>
<ol><li><p>