Group session July 1st


OK. So, there are more ways to iterate over things…


MDN: array.forEach()  (method)

Array.prototype.forEach() Function signature


someArray.forEach( function(currentItem, currentIndex, fullArray) {
	// do things



const apples = ["McIntosh", "Granny Smith", "Fuji", "Red Delicious", "Honey Crisp"];

apples.forEach( function(currentApple, appleIndex, fullApplesArray) {

	console.log('→ ', currentApple, appleIndex, fullApplesArray);


Live examples

See the Pen HTML cheatsheet 1 / display types by (@perpetual-education) on CodePen.

Do what while what?

MDN: while statement (loop)

MDN: do…while statement (loop)

Let’s do these before the for loop – because they are simple… but have more to consider in a way… and the for loop kinda encapsulates it all.

for statement

MDN: for statement (loop)

Break and Continue

for…in & for…of

MDN: for…in (loop)

MDN: for…of (loop)

Group session July 1st