operators
i++
优先级高于 ++i
loops
differences
- A
for
loop is used when you know the number of iterations the loop needs to make. - A
while
loop can be used when you need your loop to run an unknown number of times until a specific condition is met. for/in
- loops through the properties of an object.while
- loops through a block of code while a specified condition is true.do/while
- loops through a block of code once, and then repeats the loop while a specified condition is true.
skip loops
The
break
statement “jumps out” of a loop.The
continue
statement “jumps over” one iteration in the loop.