随笔小记;
ES5:
(function () {
'use strict'
var Class1 = function () {
console.log('class1')
this.fun1 = function () {
console.log('test')
}
};
Class1.prototype.fun2 = function () {
console.log('fun2')
}
new Class1().fun1();
new Class1().fun2();
})();
ES6:
class classTest {
constructor() {
console.log('es6 Class')
}
fun1 () {
console.log('fun1')
}
static fun2 () {
console.log('fun2')
}
}
new classTest().fun1();
classTest.fun2();