0

What's iteration

I usually see it

11th Mar 2021, 9:44 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
3 ответов
+ 1
Please, detail your doubt. What would you like to understand? You can easily find iteration definition in Google. Being simple, iteration is what happen when your data "talk" to each other.
11th Mar 2021, 9:46 PM
▲TopGun ▲
▲TopGun ▲ - avatar
0
What data
11th Mar 2021, 9:47 PM
Kwabena Karikari Affum
Kwabena Karikari Affum - avatar
0
Thats like.. you are going through every element in array or string or any iterable object. For example, you have a list of numbers (2,5,7,9,15) and you want to do smth with them. So.. you can double them. Lets do it: //an array of numbers let nums = [2,5,7,9,15] /* Here we doing a loop and amount of iterations depends of "nums" array length. I hope you know about loops and arrays. Then we choose every number of our array with its index (as you can see, index we got from our "i" in the loop) What's going on with "i" variable meanwhile? Depends of third part of "for" loop syntax. In most cases its growing by one. And what we have? Length of our array equals 5. First value of "i" equals 0. Every iteration it grows up by one. If we'll output it in our loop, we'll have: 0 1 2 3 4 5 */ for (let i = 0; i < nums.length; i++) { nums[i] *= 2 } T
11th Mar 2021, 10:23 PM
Nazeekk
Nazeekk - avatar