Loops


for



for - of



for - in



while

The while loop differs from the do-while loop in one important way.
In a while loop, the condition to be evaluated is tested at the beginning of each loop iteration, so if the conditional expression evaluates to false, the loop will never be executed.



for - each - in (Deprecated)

This has been deprecated and replaced with for-of
This should not be used to iterate over an array.

var myObject = {prop1: 5, prop2: 13, prop3: 8}; 

for each (var item in myObject) {
  console.log(item);
}


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext