Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
88 lines (71 loc) · 1.73 KB

File metadata and controls

88 lines (71 loc) · 1.73 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function write(args)
{
if(typeof(WScript) == "undefined")
print(args);
else
WScript.Echo(args);
}
write("Scenario 1: Adding properties on the fly");
var x = { a: 1, b: 2};
for(var i in x)
{
if(x[i] == 2)
{
x.c = 3;
x.d = 4;
}
write(x[i]);
}
write("Scenario 2: Large number of properties in forin");
var largeObj = {};
for(var k=0; k < 25; k++)
{
largeObj["p"+k] = k + 0.3;
}
for(var i in largeObj)
{
write(largeObj[i]);
}
write("Sceanrio 3: Nested Forin");
var outerObj = { a: 3, b: 4, c: 5 };
var innerObj = { a: 3, b: 4, c: 5 };
for(var i in outerObj)
{
write(i);
for(var j in innerObj)
{
write(j);
}
}
write("Scenario 4: Properties and numerical indices in object");
var objWithNumber= { a: 12, b: 13, c:23 };
objWithNumber[13] = "Number13";
objWithNumber[15] = "Number15";
for(var i in objWithNumber)
{
write(objWithNumber[i]);
}
var undef;
for(var i in undef)
{
write("FAILED: Entering enumeration of undefined");
}
var nullValue = null;
for(var i in nullValue)
{
write("FAILED: Entering enumeration of null value");
}
var integer = 3;
for(var i in integer)
{
write("FAILED: Entering enumeration of integer");
}
var double = 3.4;
for(var i in double)
{
write("FAILED: Entering enumeration of double");
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.