<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>reflect</title> </head> <body> <script> // class Person { // constructor(name, age) { // this.name = name; // this.age = age; // } // } // let person1 = new Person('彭项崇', 29); // let person2 = Reflect.construct(Person, ['陈颖', 18]); // console.log(person1); // console.log(person2); // console.log(person1.__proto__); // console.log(person2.__proto__); // console.log(Object.getPrototypeOf(person1)); // console.log(Object.getPrototypeOf(person2)); // console.log(Reflect.getPrototypeOf(person1)); // console.log(Reflect.getPrototypeOf(person2)); // const obj = { // age: 18 // }; // function fn(a, b, c) { // return this.age + a + b + c; // } // console.log(fn.apply(obj, [1, 2, 3])); // console.log(Reflect.apply(fn, obj, [1, 2, 3])); const name = Symbol('name'); let info = { name: '彭项崇', age: 29, Symbol: Symbol('1'), Symbol: Symbol('彭项崇'), [name]: '陈颖' }; console.log(Object.getOwnPropertyNames(info)); console.log(Object.getOwnPropertySymbols(info)); console.log(Reflect.ownKeys(info)); </script> </body> </html>