11.1.4_5-6-1.js (1032B)
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 info: | 6 Refer 11.1.4; 7 The production 8 ElementList : ElementList , Elisionopt AssignmentExpression 9 6.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(ToUint32((pad+len)) and the Property Descriptor { [[Value]]: initValue 10 , [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 11 es5id: 11.1.4_5-6-1 12 description: > 13 Initialize array using ElementList (ElementList , Elisionopt 14 AssignmentExpression) when index property (read-only) exists in 15 Array.prototype (step 6) 16 ---*/ 17 18 Object.defineProperty(Array.prototype, "1", { 19 value: 100, 20 writable: false, 21 configurable: true 22 }); 23 var arr = [101, 12]; 24 25 assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); 26 assert.sameValue(arr[1], 12, 'arr[1]'); 27 28 reportCompare(0, 0);