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; 17const obja = { a: 1 }; 18const copy = Object.assign({}, obja); 19print(copy.a); 20 21const o1 = { a: 1 }; 22const o2 = { b: 2 }; 23const o3 = { c: 3 }; 24 25const obj = Object.assign(o1, o2, o3); 26print(obj.a + obj.b + obj.c) 27const o4 = { a: 1, b: 1, c: 1 }; 28const o5 = { b: 2, c: 2 }; 29const o6 = { c: 3 }; 30 31const obj1 = Object.assign({}, o4, o5, o6, o6); 32print(obj1.a + obj1.b + obj1.c); 33 34const obj2 = Object.create( 35 { foo: 1 }, 36 { 37 bar: { 38 value: 2, 39 }, 40 baz: { 41 value: 3, 42 enumerable: true, 43 }, 44 }, 45); 46 47const copy1 = Object.assign({}, obj2); 48print(copy1.baz); 49print(copy1.hasOwnProperty("bar")); 50 51const v1 = "abc"; 52const v2 = true; 53const v3 = 10; 54const v4 = Symbol("foo"); 55 56const obj3 = Object.assign({}, v1, null, v2, undefined, v3, v4); 57print(Object.values(obj3)) 58