写法一:使用函数;
var ClassName = function() {
this.message = 'dat.gui';
this.speed = 0.8;
this.displayOutline = false;
this.explode = function() {};
// Define render logic ...
};
写法二:使用类和方法;
//The codes above equals to the codes below while writing it in class
class ClassName {
constructor() {
this.message = 'dat.gui';
this.speed = 0.8;
this.displayOutline = false;
}
explode() {
// Define render logic ...
};
}