Booklet

author

elya_trm

Development

Looping through an Array

Looping through an Array

for loop - The for loop for loops through a block of code a number of times. In this case 3 times, which is the length of the colors array.

while loop - The while loop loops through a block of code while a specified condition is true. In this case as long as the array length is bigger than index value.

forEach method - The forEach() method calls a function once for each array element. Having index there is optional in case you will wanna use it.

for - of statement - for-of is a new loop in ES6 that you can use instead of forEach(). You can use it to loop over all iterable objects: arrays, strings, maps etc.

More booklets by elya_trm

  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images

More Development booklets

Your recently viewed booklets

  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
  • booklet-slide-images
See all booklets