一、基于ES6中的CLASS重构下面的代码
function ModalFun(x,y){
this.x=x;
this.y=y;
}
ModalFun.prototype.z=10;
ModalFun.prototype.getX=function(){
console.log(this.x);
}
ModalFun.prototype.getY=function(){
console.log(this.y);
}
ModalFun.n=200;
ModalFun.setNumber=function(n){
this.n=n;
};
let m = new ModalFun(10,20);
console.dir(m)
console.dir(ModalFun)
class Modal{
constructor(x,y){
this.x = x
this.y = y
}
z=10
getX = ()=>{}
getX(){
console.log(this.x)
}
getY(){
console.log(this.y)
}
static o =8
static setMumber(){
this.o =90
}
}
Modal.prototype.p=1
let m = new Modal(10,20);
console.dir(m)
console.dir(Modal.setMumber())
console.dir(Modal)