JavaScript定义类的两种方式
方式一
let Car = (function () {
function Car() {
}
Car.prototype.moveCar = function () {
}
return Car;
})();
方式二
class Car {
constructor() {
}
moveCar() {
}
}
let Car = (function () {
function Car() {
}
Car.prototype.moveCar = function () {
}
return Car;
})();
class Car {
constructor() {
}
moveCar() {
}
}