什麼是 JavaScript 中的預設建構函式?
如果未新增建構函式方法,則應使用預設建構函式。在未定義任何內容時建立預設建構函式。
語法
以下是語法 −
constructor() {}派生類的語法 −
constructor(...args) {
super(...args);
}
廣告
如果未新增建構函式方法,則應使用預設建構函式。在未定義任何內容時建立預設建構函式。
以下是語法 −
constructor() {}派生類的語法 −
constructor(...args) {
super(...args);
}