1. 程式人生 > >JavaScript&jQuery.dowhile

JavaScript&jQuery.dowhile

lai html script 結束 space x11 dex do while line

dowhile


do ... while循環與while循環相似,只是條件檢查發生在循環結束處。 這意味著即使條件為假,循環也將始終至少執行一次。

<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <title>do while 循環</title> </head> <body> <script> var i=0; do{ println(i); i++;
}while (i<10); function println(a) { document.write(a); document.write(‘<br>‘); } </script> </body> </html>

JavaScript&jQuery.dowhile