当我在JavaScript中创建类时,我可以在类体外部定义静态方法。我真的还可以添加非静态方法的定义吗?
class Class {
fun() {console.log("some method")} //how to put it outside Class body?
}
Class.static_fun = function () {
console.log("some static method");
}
var object = new Class();
Class.static_fun();
object.fun();