diff options
Diffstat (limited to 'files/zh-tw/web/javascript/reference/classes/constructor/index.html')
-rw-r--r-- | files/zh-tw/web/javascript/reference/classes/constructor/index.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-tw/web/javascript/reference/classes/constructor/index.html b/files/zh-tw/web/javascript/reference/classes/constructor/index.html index 8da81e9b71..aa0e2bf896 100644 --- a/files/zh-tw/web/javascript/reference/classes/constructor/index.html +++ b/files/zh-tw/web/javascript/reference/classes/constructor/index.html @@ -9,7 +9,7 @@ translation_of: Web/JavaScript/Reference/Classes/constructor <h2 id="語法">語法</h2> -<pre class="syntaxbox notranslate">constructor([arguments]) { ... }</pre> +<pre class="syntaxbox">constructor([arguments]) { ... }</pre> <h2 id="敘述">敘述</h2> @@ -23,7 +23,7 @@ translation_of: Web/JavaScript/Reference/Classes/constructor <p>這段程式碼是從 <a href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">classes sample</a> 擷取而來。(<a href="https://googlechrome.github.io/samples/classes-es6/index.html">線上範例</a>)</p> -<pre class="brush: js notranslate">class Square extends Polygon { +<pre class="brush: js">class Square extends Polygon { constructor(length) { // 我們在這裡呼叫了 class 的建構子提供多邊形的長寬值 super(length, length); @@ -44,12 +44,12 @@ translation_of: Web/JavaScript/Reference/Classes/constructor <p>如上文所說:如果不指定建構子,就會使用預設的建構子。對 base classes 而言,預設的建構子長得像這樣:</p> -<pre class="brush: js notranslate">constructor() {} +<pre class="brush: js">constructor() {} </pre> <p>對 derived class 而言,預設的建構子長得像這樣:</p> -<pre class="brush: js notranslate">constructor(...args) { +<pre class="brush: js">constructor(...args) { super(...args); }</pre> |