// 类组件 class Person { constructor (name,age) { this.name =name this.age = age } sayHi () { console.log(this) } } let person = new Person(‘李李‘) person.sayHi()
关键字:class、constructor
原文地址:https://www.cnblogs.com/js-liqian/p/11747761.html
时间: 2024-10-14 12:53:21