diff options
Diffstat (limited to 'files/id/web/javascript/reference/global_objects/array/unshift/index.html')
-rw-r--r-- | files/id/web/javascript/reference/global_objects/array/unshift/index.html | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/files/id/web/javascript/reference/global_objects/array/unshift/index.html b/files/id/web/javascript/reference/global_objects/array/unshift/index.html deleted file mode 100644 index 4df2069f54..0000000000 --- a/files/id/web/javascript/reference/global_objects/array/unshift/index.html +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Array.prototype.unshift() -slug: Web/JavaScript/Reference/Global_Objects/Array/unshift -translation_of: Web/JavaScript/Reference/Global_Objects/Array/unshift ---- -<div>{{JSRef}}</div> - -<p>Method <code><strong>unshift()</strong></code> menambahkan satu atau lebih elemen ke indek awal array dan mengembalikan jumlah index array yang baru.</p> - -<h2 id="Sintaks">Sintaks</h2> - -<pre class="syntaxbox"><code><var>arr</var>.unshift([<var>element1</var>[, ...[, <var>elementN</var>]]])</code></pre> - -<h3 id="Parameter">Parameter</h3> - -<dl> - <dt><code>element<em>N</em></code></dt> - <dd>Elemen yang akan di tambahkan di awal array.</dd> -</dl> - -<h3 id="Returns">Returns</h3> - -<p>Properti {{jsxref("Array.length", "length")}} baru dari objek teratas dimana method di panggil.</p> - -<h2 id="Deskripsi">Deskripsi</h2> - -<p>Method <code>unshift</code> menambahkan nilai yang diberikan ke awal objek array.</p> - -<p><code>unshift</code> biasanya generic; method ini bisa berupa {{jsxref("Function.call", "called", "", 1)}} atau {{jsxref("Function.apply", "applied", "", 1)}} ke objek menyerupai array. Objek yang tidak memiliki properti <code>length</code> mencerminkan dari serangkaian urutan, properti numerik berbasis zero kemungkinan tidak berperilaku dengan cara yang berarti.</p> - -<h2 id="Contoh">Contoh</h2> - -<pre class="brush: js">var arr = [1, 2]; - -arr.unshift(0); // result of call is 3, the new array length -// arr is [0, 1, 2] - -arr.unshift(-2, -1); // = 5 -// arr is [-2, -1, 0, 1, 2] - -arr.unshift([-3]); -// arr is [[-3], -2, -1, 0, 1, 2] -</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('ES3')}}</td> - <td>{{Spec2('ES3')}}</td> - <td>Initial definition. Implemented in JavaScript 1.2.</td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-15.4.4.13', 'Array.prototype.unshift')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}</td> - <td>{{Spec2('ES6')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-array.prototype.unshift', 'Array.prototype.unshift')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Kompabilitas_Browser">Kompabilitas Browser</h2> - -<div>{{CompatibilityTable}}</div> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatChrome("1.0")}}</td> - <td>{{CompatGeckoDesktop("1.7")}}</td> - <td>{{CompatIE("5.5")}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - <td>{{CompatVersionUnknown}}</td> - </tr> - </tbody> -</table> -</div> - -<h2 id="Lihat_juga">Lihat juga</h2> - -<ul> - <li>{{jsxref("Array.prototype.push()")}}</li> - <li>{{jsxref("Array.prototype.pop()")}}</li> - <li>{{jsxref("Array.prototype.shift()")}}</li> -</ul> |