diff options
Diffstat (limited to 'files/id/web/javascript/reference/statements/class/index.html')
-rw-r--r-- | files/id/web/javascript/reference/statements/class/index.html | 171 |
1 files changed, 0 insertions, 171 deletions
diff --git a/files/id/web/javascript/reference/statements/class/index.html b/files/id/web/javascript/reference/statements/class/index.html deleted file mode 100644 index 6ca35e9c71..0000000000 --- a/files/id/web/javascript/reference/statements/class/index.html +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: class -slug: Web/JavaScript/Reference/Statements/class -tags: - - Classes - - Declaration - - ECMAScript6 - - Referensi -translation_of: Web/JavaScript/Reference/Statements/class ---- -<div>{{jsSidebar("Statements")}}</div> - -<p>Deklarasi <strong>class</strong> digunakan untuk membuat class baru dengan nama menggunakan turunan berbasis prototype.</p> - -<div class="noinclude"> -<p>Anda juga bisa mendefinisikan kelas menggunakan{{jsxref("Operators/class", "class expression", "", 1)}}.</p> -</div> - -<h2 id="Sintaks">Sintaks</h2> - -<pre class="brush: js">class <em>name</em> [extends] { - // class body -} -</pre> - -<h2 id="Deskripsi">Deskripsi</h2> - -<p>Seperti halnya dengan ekspresi class, pembentuk (body) class dari deklarasi class di jalankan pada <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode">strict mode</a>.</p> - -<p>Deklarasi class bukanlah {{Glossary("Hoisting", "hoisted")}} (Tidak seperti <a href="/en-US/docs/Web/JavaScript/Reference/Statements/function">function declarations</a>).</p> - -<h2 id="Contoh">Contoh</h2> - -<h3 id="Dasar_deklarasi_class">Dasar deklarasi class</h3> - -<p>Pada contoh, hal pertama yang kita lakukan adalah mendefinisikan class dengan nama Polygon, kemudian membentangkannya ( extend ) untuk membuat class bernama Square. Perlu diperhatikan bahwa super(), digunakan pada constructor, hanya dapat digunakan di konstruktor dan harus dipanggil setelah keyword 'this' dapat digunakan.</p> - -<pre class="brush: js">class Polygon { - constructor(height, width) { - this.name = 'Polygon'; - this.height = height; - this.width = width; - } -} - -class Square extends Polygon { - constructor(length) { - super(length, length); - this.name = 'Square'; - } -}</pre> - -<h2 id="Spesifikasi">Spesifikasi</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spesifikasi</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-class-definitions', 'Class definitions')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Initial definition.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-class-definitions', 'Class definitions')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Kompabilitas_Browser">Kompabilitas Browser</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Fitur</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Dukungan dasar</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoDesktop(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Array subclassing</td> - <td>{{CompatChrome(43.0)}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - </tr> - <tr> - <td>Allowed in sloppy mode</td> - <td>{{CompatChrome(49.0)}}</td> - <td> </td> - <td> </td> - <td> </td> - <td> </td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Fitur</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Dukungan dasar</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(42.0)}}</td> - <td>{{CompatGeckoMobile(45)}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(42.0)}}</td> - </tr> - <tr> - <td>Array subclassing</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(43.0)}}</td> - <td>{{CompatNo}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatChrome(43.0)}}</td> - </tr> - <tr> - <td>Allowed in sloppy mode</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(49.0)}}</td> - <td> </td> - <td> </td> - <td> </td> - <td> </td> - <td>{{CompatChrome(49.0)}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Lihat_Juga">Lihat Juga</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Statements/function"><code>function</code> declaration</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/class"><code>class</code> expression</a></li> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Classes">Classes</a></li> -</ul> |