Debian Codegraph @

js/src/tests/test262/language/expressions/array/11.1.4_4-5-1.js

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