Operators and Loops

This is my reading notes for Code Fellows.

Operators and Loops

Operators

For operators please refer programing JS

Loops!

Loops offer a quick and easy way to do something repeatedly.

There are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. (Note that it’s possible that number could be zero!)

For Statement

A for loop repeats until a specified condition evaluates to false.

` for ([initialExpression]; [conditionExpression]; [incrementExpression]) statement `

When a for loop executes, the following occurs:

While Statement.

A while statement executes its statements as long as a specified condition evaluates to true. A while statement looks as follows:


 while (condition)
  statement

If the condition becomes false, statement within the loop stops executing and control passes to the statement following the loop.

The condition test occurs before statement in the loop is executed. If the condition returns true, statement is executed and the condition is tested again. If the condition returns false, execution stops, and control is passed to the statement following while.


Home