面向对象基础语法
class User{
constructor(name, password){
this.name = name
this.password = password
}
showName(){
console.log(this.name)
}
}
//继承
class Vip extends User{
constructor(name, password, level){
super(name, password)
this.level = level
}
showLevel(){
console.log(this.level)
}
}
let v = new Vip('张三', '21222', 9)
v.showName() // 张三
v.showLevel() // 9