1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/*
17 * @tc.name:objectcloneproperties
18 * @tc.desc:test object clone properties
19 * @tc.type: FUNC
20 * @tc.require: issueI5NO8G
21 */
22function fn(e) {
23    return e;
24}
25var obj2 = new Int32Array(2);
26var obj1 = {
27    length: 1,
28    0: 'a',
29    toString() {return 'obj1';}
30};
31var obj3 = {
32    get length() {throw "should not even consider the length property"},
33    toString() {return 'obj3';}
34};
35var arr = [obj1, obj2, obj3];
36var actual = arr.flatMap(fn);
37var arrLike = {
38    length: 4,
39    0: obj1,
40    1: obj2,
41    2: obj3,
42    get 3() {return arrLike},
43    toString() {return 'obj4';}
44};
45actual = [].flatMap.call(arrLike, fn);
46print(actual);