aboutsummaryrefslogtreecommitdiff
path: root/files/vi/web/javascript/reference/statements/do...while
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
commit218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch)
treea9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/vi/web/javascript/reference/statements/do...while
parent074785cea106179cb3305637055ab0a009ca74f2 (diff)
downloadtranslated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip
initial commit
Diffstat (limited to 'files/vi/web/javascript/reference/statements/do...while')
-rw-r--r--files/vi/web/javascript/reference/statements/do...while/index.html98
1 files changed, 98 insertions, 0 deletions
diff --git a/files/vi/web/javascript/reference/statements/do...while/index.html b/files/vi/web/javascript/reference/statements/do...while/index.html
new file mode 100644
index 0000000000..eef8cf1f08
--- /dev/null
+++ b/files/vi/web/javascript/reference/statements/do...while/index.html
@@ -0,0 +1,98 @@
+---
+title: do...while
+slug: Web/JavaScript/Reference/Statements/do...while
+translation_of: Web/JavaScript/Reference/Statements/do...while
+---
+<div>{{jsSidebar("Statements")}}</div>
+
+<p><strong>Vòng lặp</strong> <strong><code>do...while</code></strong> tạo ra vòng lặp thực thi các câu lệnh bên trong nó đến khi điều kiện không còn thoả mãn nữa. Điều kiện của vòng lặp sẽ được kiểm tra sau thực thi các câu lệnh, các câu lệnh của vòng lặp sẽ được thực thi ít nhất một lần.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/statement-dowhile.html")}}</div>
+
+
+
+<h2 id="Cú_pháp">Cú pháp</h2>
+
+<pre class="syntaxbox">do
+ <em>// các câu lệnh</em>
+while (<em>// điều kiện</em>);
+</pre>
+
+<dl>
+ <dt><code>statement</code></dt>
+ <dd>A statement that is executed at least once and is re-executed each time the condition evaluates to true. To execute multiple statements within the loop, use a {{jsxref("Statements/block", "block")}} statement (<code>{ ... }</code>) to group those statements.</dd>
+</dl>
+
+<dl>
+ <dt><code>condition</code></dt>
+ <dd>An expression evaluated after each pass through the loop. If <code>condition</code> evaluates to true, the <code>statement</code> is re-executed. When <code>condition</code> evaluates to false, control passes to the statement following the <code>do...while</code>.</dd>
+</dl>
+
+<h2 id="Examples" name="Examples">Examples</h2>
+
+<h3 id="Using_do...while">Using <code>do...while</code></h3>
+
+<p>In the following example, the <code>do...while</code> loop iterates at least once and reiterates until <code>i</code> is no longer less than 5.</p>
+
+<h3 id="HTML_content">HTML content</h3>
+
+<pre class="brush: html">&lt;div id="example"&gt;&lt;/div&gt;</pre>
+
+<h3 id="JavaScript_content">JavaScript content</h3>
+
+<pre class="brush: js">var result = '';
+var i = 0;
+do {
+   i += 1;
+   result += i + ' ';
+} while (i &lt; 5);
+document.getElementById('example').innerHTML = result;</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{ EmbedLiveSample('Examples') }}</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</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-12.6.1', 'do-while statement')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-do-while-statement', 'do-while statement')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Trailing ; is now optional.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-do-while-statement', 'do-while statement')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("javascript.statements.do_while")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{jsxref("Statements/while", "while")}}</li>
+ <li>{{jsxref("Statements/for", "for")}}</li>
+</ul>