JavaScript for Beginners: forEach loop

preview_player
Показать описание
In this video I will show you how to use the forEach method to loop through an array in JavaScript.

00:00 Intro
00:06 Disclaimer!
00:35 How the forEach loop works?
03:20 How can you use the index argument?

#javascriptforbeginners #javascript #coding #forEachLoop

saperis - Technology made easy

Рекомендации по теме
Комментарии
Автор

Hey, I just wanted to thank you for your videos! You do such an excellent job at explaining. I especially love your videos on Google App Scripts! Keep up the good work :)

ronaldjohnson_ita
Автор

Thank you! You really helped me a lot with the forEach loop! 😀 Everything is crystal clear nevertheless some doubts remain in my mind about the "index" part of the video at 3:22.

Does the function know we want it to give us the index of the element because the second argument is literally "index" and it's some kind of reserved word for this task by javascript.

Or could we have used any other word like "carrot", "bike" or "green" as a second argument and it still would have give us the index of the element?

My question may sound weird but I really need to understand this. If someone has the answer please consider sharing it with me I would be incredibly thankful😀

bedtimehorrorstoryyoutube