forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforInMisc.js
More file actions
52 lines (45 loc) · 1.19 KB
/
forInMisc.js
File metadata and controls
52 lines (45 loc) · 1.19 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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var echo = WScript.Echo;
// regress WOOB 1143623
function find(arr, value) {
var result = -1;
for(var i in arr)
{
echo("enumerated index:", i);
if(arr[i] == value)
{
result = i;
break;
}
}
return result;
}
var arr = [0, 1, 2, 3, 4, 5];
echo("Find 3 at index: ", find(arr, 3));
function propCacheTest()
{
var obj = new Object();
for (var i = 0; i < 10; i++)
{
obj["randomprop" + i] = i;
}
var propArray = new Array();
for (var prop in obj)
{
propArray[propArray.length] = prop;
}
for (var prop in Array)
{
}
obj = null;
return propArray;
}
var props = propCacheTest();
CollectGarbage();
for (var i = 0; i < props.length; i++)
{
echo(props[i]);
}