forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringindex.js
More file actions
37 lines (31 loc) · 890 Bytes
/
stringindex.js
File metadata and controls
37 lines (31 loc) · 890 Bytes
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
//-------------------------------------------------------------------------------------------------------
// 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)
{
WScript.Echo(args);
}
write("Scenario 1");
var sl = "hello";
for (var i=0;i<8;i++)
{
write(sl.propertyIsEnumerable(i));
write(sl.hasOwnProperty(i));
write(sl[i]);
}
write("Scenario 2");
var so = new String("hello");
so[1] = 10;
so[4] = 20;
so[7] = 30;
so.x = 20;
for (var i=0;i<8;i++)
{
write(so.propertyIsEnumerable(1));
write(so.hasOwnProperty(i));
write(so[i]);
}
write(so.propertyIsEnumerable("x"));
write(so.hasOwnProperty("x"));
write(so["x"]);