forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray.js
More file actions
55 lines (42 loc) · 1.41 KB
/
Array.js
File metadata and controls
55 lines (42 loc) · 1.41 KB
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var a = new Array(10);
var b = new Array();
var c = new Array("muck", 3.2, 0, 18);
c[-1] = "minus 1";
WScript.Echo("Store a single item in a");
a[1] = 10;
WScript.Echo(a[1]);
WScript.Echo("Store a single item in b");
b[3] = 99;
WScript.Echo(b[3]);
for (var i = -1; i < c.length; i++) {
WScript.Echo(c[i]);
}
// Test boolean expressions in an initializer
var x = {}, y = false;
WScript.Echo([x||y]);
WScript.Echo([x&&y]);
WScript.Echo([x ? y : x]);
WScript.Echo([y ? x : y]);
WScript.Echo([y||x]);
WScript.Echo(y&&x);
WScript.Echo([x||y, x&&y, x ? y : x, y ? x : y, y||x, y&&x]);
// Test some boundary property names
var o = [];
o["4294967294"] = 100;
WScript.Echo(o["4294967294"]);
o["4294967295"] = 101;
WScript.Echo(o["4294967295"]);
o["4294967296"] = 102;
WScript.Echo(o["4294967296"]);
o["4088701331"] = 103;
WScript.Echo(o["4088701331"]);
o["40887013312"] = 104;
WScript.Echo(o["40887013312"]);
o["4088.7013"] = 105;
WScript.Echo(o["4088.7013"]);
o["408870133X"] = 106;
WScript.Echo(o["408870133X"]);