forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
35 lines (28 loc) · 1.2 KB
/
array.js
File metadata and controls
35 lines (28 loc) · 1.2 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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var x = [3, null, {}];
var y = x;
y.baz = 5;
WScript.SetTimeout(testFunction, 50);
/////////////////
function testFunction()
{
telemetryLog(`Array.isArray(x): ${Array.isArray(x)}`, true); //true
telemetryLog(`x.length: ${x.length}`, true); //3
telemetryLog(`x === y: ${x === y}`, true); //true
telemetryLog(`x.baz: ${x.baz}`, true); //5
telemetryLog(`x[0]: ${x[0]}`, true); //3
telemetryLog(`y[1]: ${y[1]}`, true); //null
telemetryLog(`x[5]: ${x[5]}`, true); //undefined
////
x[1] = "non-null";
x[5] = { bar: 3 };
x.push(10);
////
telemetryLog(`post update -- y[1]: ${y[1]}`, true); //non-null
telemetryLog(`post update -- x[5] !== null: ${x[5] !== null}`, true); //true
telemetryLog(`post update -- x[5].bar: ${x[5].bar}`, true); //3
telemetryLog(`post update -- y[6]: ${y[6]}`, true); //10
}