15.2.3.7-6-a-184.js (867B)
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-184 6 description: > 7 Object.defineProperties - TypeError is thrown if 'O' is an Array, 8 'P' is an array index named property,[[Writable]] attribute of the 9 length property in 'O' is false, value of 'P' is equal to value of 10 the length property in 'O' (15.4.5.1 step 4.b) 11 ---*/ 12 13 var arr = [1, 2, 3]; 14 15 Object.defineProperty(arr, "length", { 16 writable: false 17 }); 18 assert.throws(TypeError, function() { 19 Object.defineProperties(arr, { 20 "3": { 21 value: "abc" 22 } 23 }); 24 }); 25 assert.sameValue(arr[0], 1, 'arr[0]'); 26 assert.sameValue(arr[1], 2, 'arr[1]'); 27 assert.sameValue(arr[2], 3, 'arr[2]'); 28 assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")'); 29 30 reportCompare(0, 0);