15.2.3.7-6-a-162.js (903B)
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-162 6 description: > 7 Object.defineProperties - 'O' is an Array, 'P' is the length 8 property of 'O', the [[Value]] field of 'desc' is less than value 9 of the length property, test the [[Writable]] attribute of the 10 length property is set to true at last after deleting properties 11 with large index named if the [[Writable]] field of 'desc' is true 12 (15.4.5.1 step 3.h) 13 ---*/ 14 15 var arr = [0, 1]; 16 17 Object.defineProperties(arr, { 18 length: { 19 value: 1, 20 writable: true 21 } 22 }); 23 24 arr.length = 10; //try to overwrite length value of arr 25 26 assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); 27 assert.sameValue(arr.length, 10, 'arr.length'); 28 assert.sameValue(arr[0], 0, 'arr[0]'); 29 30 reportCompare(0, 0);