[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Statements/do...while [Back]  [Original]

do...while - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

do...while

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

do...while , , . , .

In this article

let result = "";
let i = 0;

do {
  i = i + 1;
  result = result + i;
} while (i < 5);

console.log(result);
// Expected output: "12345"

do
   
while ();

, , . , ({ ... }).

, . , . , , do...while.

do...while

, do...while , i 5.

HTML

html
<div id="example"></div>

JavaScript

js
var result = "";
var i = 0;
do {
  i += 1;
  result += i + " ";
} while (i > 0 && i < 5); //   ,  i == 0,    ,     
document.getElementById("example").innerHTML = result;

Specification
ECMAScript 2027 LanguageSpecification
# sec-do-while-statement


Web Proxy Viewer  |  New URL  |  Original Page