freeCodeCamp/guide/chinese/javascript/tutorials/iterate-with-javascript-whi.../index.md

14 lines
339 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Iterate with JavaScript While Loops
localeTitle: 在循环时使用JavaScript进行迭代
---
另一种类型的JavaScript循环称为`while loop`因为它`while`某些内容为true时运行并在某些内容不再为true时停止。
```
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
```