diff options
| author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
| commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
| tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/id/web/javascript/reference/errors/too_much_recursion | |
| parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
| download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip | |
remove retired locales (#699)
Diffstat (limited to 'files/id/web/javascript/reference/errors/too_much_recursion')
| -rw-r--r-- | files/id/web/javascript/reference/errors/too_much_recursion/index.html | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/files/id/web/javascript/reference/errors/too_much_recursion/index.html b/files/id/web/javascript/reference/errors/too_much_recursion/index.html deleted file mode 100644 index 4c35bcfc83..0000000000 --- a/files/id/web/javascript/reference/errors/too_much_recursion/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: 'InternalError: too much recursion' -slug: Web/JavaScript/Reference/Errors/Too_much_recursion -tags: - - Errors - - InternalError - - JavaScript -translation_of: Web/JavaScript/Reference/Errors/Too_much_recursion ---- -<div>{{jsSidebar("Errors")}}</div> - -<h2 id="Pesan">Pesan</h2> - -<pre class="syntaxbox">Error: Out of stack space (Edge) -InternalError: too much recursion (Firefox) -RangeError: Maximum call stack size exceeded (Chrome) -</pre> - -<h2 id="Tipe_error">Tipe error</h2> - -<p>{{jsxref("InternalError")}}.</p> - -<h2 id="Apa_yang_salah">Apa yang salah?</h2> - -<p>Fungsi yang memanggil dirinya sendiri disebut <em>fungsi rekursif</em>. Sekali satu kondisi telah ketemu, fungsi itu berhenti memanggil dirinya. Ini disebut <em>base case</em>.</p> - -<p>Dalam beberapa cara, rekursi analog dengan loop. Keduanya mengeksekusi kode yang sama berulang kali, dan keduanya membutuhkan satu kondisi (untuk mencegah loop tak-terbatas, atau lebih tepatnya, rekursi tak-terbatas dalam hal ini). <span class="seoSummary">Ketika panggilan fungsi terlalu banyak, atau tak ada base case dalam fungsi, JavaScript akan melempar error ini.</span></p> - -<h2 id="Contoh">Contoh</h2> - -<p>Fungsi rekursif ini berjalan 10 kali, per kondisi exit.</p> - -<pre class="brush: js">function loop(x) { - if (x >= 10) // "x >= 10" is the exit condition - return; - // do stuff - loop(x + 1); // the recursive call -} -loop(0);</pre> - -<p>Mengeset kondisi ini ke nilai extrem sangat tinggi, tak akan jalan:</p> - -<pre class="brush: js example-bad">function loop(x) { - if (x >= 1000000000000) - return; - // do stuff - loop(x + 1); -} -loop(0); - -// InternalError: too much recursion</pre> - -<p>Fungsi rekursif ini tak punya base case. Jika tak kondisi exit, function akan memanggil dirinya sendiri terus-terusan.</p> - -<pre class="brush: js example-bad">function loop(x) { - // The base case is missing - -loop(x + 1); // Recursive call -} - -loop(0); - -// InternalError: too much recursion</pre> - -<h2 id="Lihat_juga">Lihat juga</h2> - -<ul> - <li>{{Glossary("Rekursi")}}</li> - <li><a href="/en-US/docs/Web/JavaScript/Guide/Functions#Recursion">Fungsi rekursif</a></li> -</ul> |
