15.2.3.7-6-a-198.js (934B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es5id: 15.2.3.7-6-a-198 6 description: > 7 Object.defineProperties - 'O' is an Array, 'P' is an array index 8 named property, 'P' property doesn't exist in 'O', test 9 [[Enumerable]] of 'P' property in 'Attributes' is set as false 10 value if [[Enumerable]] is absent in data descriptor 'desc' 11 (15.4.5.1 step 4.c) 12 ---*/ 13 14 var arr = []; 15 var isOwnProperty = false; 16 var canEnumerable = false; 17 18 Object.defineProperties(arr, { 19 "0": { 20 value: 1001, 21 writable: true, 22 configurable: true 23 } 24 }); 25 26 isOwnProperty = arr.hasOwnProperty("0"); 27 for (var i in arr) { 28 if (i === "0") { 29 canEnumerable = true; 30 } 31 } 32 33 assert(isOwnProperty, 'isOwnProperty !== true'); 34 assert.sameValue(canEnumerable, false, 'canEnumerable'); 35 assert.sameValue(arr[0], 1001, 'arr[0]'); 36 37 reportCompare(0, 0);