JavaScript Loops

up:: JavaScript

For Each

ratingArr.forEach(element => {
	mikeRatingSum += parseFloat(element.ratingMike);
	joeRatingSum += parseFloat(element.ratingJoe);
});

Loops

  • While: while (age < 10){age++;}
  • for (age = 5; age <10; age++){}
  • Arrays: for / of
  • Objects (key + name): for / in
  • Break out of a loop with break;, ignore code below with continue;