-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathArrayResize.js
42 lines (34 loc) · 950 Bytes
/
ArrayResize.js
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
//
// Allocate an initial array and set some fields.
//
var a1 = new Array();
a1[2] = "B";
a1[3] = "C";
//
// Cause the array to grow in storage.
//
a1[20] = "T";
//
// Dump the contents of the array, ensuring that uninitialized fields are properly set to
// 'undefined'.
//
for (var idx = 0; idx < a1.length; idx++)
{
var val = a1[idx];
if (val == undefined)
{
WScript.Echo("undefined");
}
else if (val == null)
{
WScript.Echo("null");
}
else
{
WScript.Echo(val);
}
}