forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumericPropertyIsEnumerable.js
More file actions
24 lines (20 loc) · 1.03 KB
/
NumericPropertyIsEnumerable.js
File metadata and controls
24 lines (20 loc) · 1.03 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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function verify(act,exp,msg)
{
if(act!=exp)
WScript.Echo(act + " " + msg);
else
WScript.Echo("pass");
};
var myobj = { a: "apple", 101: 1 }
verify (myobj.propertyIsEnumerable('a'), true, "property should be enumerable");
verify (myobj.propertyIsEnumerable(101), true, "numeric property should be enumerable");
verify (myobj.propertyIsEnumerable("101"), true, "numeric property should be enumerable");
verify (myobj.propertyIsEnumerable("10"), false, "non-existent numeric property should not be enumerable");
for (o in myobj)
{
verify (myobj.propertyIsEnumerable(o), true, "for...in loop propertyIsEnumerable enum testing");
}