美文网首页
for循环是do循环的变形

for循环是do循环的变形

作者: 短衣匹马 | 来源:发表于2016-05-20 15:52 被阅读38次

for循环是do循环的变体形式

eg:

var count = 1; do{ alert(count); count++; } while (count < 11);

而使用for循环就简便了许多

for(count = 1;count < 11; count++){ alert(count;) }
而同时for循环就与do循环一样会至少执行一次。

相关文章

网友评论

      本文标题:for循环是do循环的变形

      本文链接:https://www.haomeiwen.com/subject/ffenrttx.html