indices-array-properties.js (822B)
1 // Copyright 2019 Ron Buckton. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: The properties of the "indices" array are created with CreateDataProperty. 6 includes: [propertyHelper.js] 7 esid: sec-makeindicesarray 8 features: [regexp-match-indices] 9 info: | 10 MakeIndicesArray ( S, indices, groupNames, hasGroups ) 11 13. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do 12 d. Perform ! CreateDataProperty(_A_, ! ToString(_n_), _matchIndicesArray_). 13 ---*/ 14 15 let input = "abcd"; 16 let match = /b(c)/d.exec(input); 17 let indices = match.indices; 18 19 verifyProperty(indices, '0', { 20 enumerable: true, 21 configurable: true, 22 writable: true 23 }); 24 25 verifyProperty(indices, '1', { 26 enumerable: true, 27 configurable: true, 28 writable: true 29 }); 30 31 reportCompare(0, 0);