In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what is the loop structure in javascript, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
There are three kinds of js loop structures: 1, for loop, syntax "for (initialization statement; loop condition; self-increment or self-subtraction) {code block}"; 2, while loop, syntax "while (conditional statement) {code block}"; 3, "do while" loop, syntax "do {statement block} while;"
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
The so-called loop is the repeated execution of a piece of code, the judgment of the computer is far worse than that of people, and the computer is better at one thing-repeating over and over again. And we call this a loop in JavaScript. Let's take a look at the loops in JavaScript.
What are the structures of js loops
There are three kinds of js loop structures.
For loop = = > is used to traverse the code block multiple times
While loop = = > Loop code block when the specified condition is true
Do while loop = = > Loop code block when the specified condition is true
1. For cycle
For is composed of two parts, the conditional control and the cyclic body.
Syntax:
For (initialization statement; loop condition; self-increment or self-subtraction) {code blocks that need to be repeated;}
The structure of the for statement is as follows:
The execution order of the for loop
1. Initialization expression
2. Cyclic conditional expression
3. Code blocks that need to repeat
4. The operation expression after the loop
A simple for loop that changes the value of a variable at a time
Example: output values from 1 to 100
For (var iTunes 1; I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.