test/mjsunit/object-seal.js
// Verify flat, map, slice, flatMap, join, reduce, reduceRight for sealed packed array
Verify flat, map, slice, flatMap, join, reduce, reduceRight for sealed packed array
Verify flat map slice flatMap join reduce reduceRight for sealed packed array
function testDoubleSealedArray2(arr) {
  assertTrue(Object.isSealed(arr));
  assertTrue(Array.isArray(arr));
  assertEquals(arr.map(x => [x]), [[1], [1.1], [0]]);
  assertEquals(arr.flatMap(x => [x]), arr);
  assertEquals(arr.flat(), arr);
  assertEquals(arr.join('-'), "1-1.1-0");
  const reducer = (accumulator, currentValue) => accumulator + currentValue;
  assertEquals(arr.reduce(reducer), 2.1);
  assertEquals(arr.reduceRight(reducer), 2.1);
  assertEquals(arr.slice(0, 1), [1]);
}
function testDoubleSealedArray2 ( arr ) { assertTrue ( Object . isSealed ( arr ) ) ; assertTrue ( Array . isArray ( arr ) ) ; assertEquals ( arr . map ( x => [ x ] ) , [ [ 1 ] , [ 1.1 ] , [ 0 ] ] ) ; assertEquals ( arr . flatMap ( x => [ x ] ) , arr ) ; assertEquals ( arr . flat ( ) , arr ) ; assertEquals ( arr . join ( '-' ) , "1-1.1-0" ) ; const reducer = ( accumulator , currentValue ) => accumulator + currentValue ; assertEquals ( arr . reduce ( reducer ) , 2.1 ) ; assertEquals ( arr . reduceRight ( reducer ) , 2.1 ) ; assertEquals ( arr . slice ( 0 , 1 ) , [ 1 ] ) ; }
Verify flat, map, slice, flatMap, join, reduce, reduceRight for sealed packed array
Verify flat map slice flatMap join reduce reduceRight for sealed packed array