1/* 2 * Copyright (c) 2023 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 16declare function print(arg:any):string; 17{ 18 let a = [] 19 let l = a.push(1) 20 print(l) 21 l = a.push(1, 2, 3, 4, 5) 22 print(l) 23 24 for (let i = 0; i < 100; i++) { 25 a.push(i) 26 } 27 28 let c = [1, 2, 3, 4] 29 a.push(...c) 30 31 print(a.length) 32 33 let b = [] 34 b.push(1, 2, 3, 4) 35 b.push(1, 2, 3) 36 b.push(1, 2) 37 b.push(1) 38 b.push() 39 print(Object.values(b)) 40 print(b.length) 41} 42 43{ 44 let result; 45 let array = new Array(); 46 let array_size = 100; 47 48 for (let i = 0; i < array_size; i++) { 49 array[i] = i; 50 } 51 52 result = array.sort((a, b) => { 53 return a - b 54 }); 55 56 print(result); 57 58 result = array.sort(); 59 print(result); 60}