請教一下關于constructor的問題
export default class Pool {
?constructor() {
? ?this[__.poolDic] = {? }
?}
我只知道construct屬性指向其構造函數。
這個?constructor( ) { }是在做函數聲明嗎?他和function有什么區別?新人求教
export default class Pool {
?constructor() {
? ?this[__.poolDic] = {? }
?}
我只知道construct屬性指向其構造函數。
這個?constructor( ) { }是在做函數聲明嗎?他和function有什么區別?新人求教
2018-08-16
舉報
2018-08-23
es6語法,是一種簡寫,相當于? constructor : function(){?this[__.poolDic] = {? } } , 在class中只能簡寫,在普通對象中兩種方式都可以