Please why is the index not persevered in the first group? After creating a reference to the property, it preserved the i. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please why is the index not persevered in the first group? After creating a reference to the property, it preserved the i.

https://code.sololearn.com/cMINNcHv9gKK/?ref=app

6th Feb 2021, 12:23 PM
جوردن آهو ماولی
جوردن آهو ماولی - avatar
2 Answers
+ 2
i is always preserved, but in the first case you are calling next method on a new 'g' function result, while in the second case, you first define only one 'g' function result, and use it multiple time...
6th Feb 2021, 1:19 PM
visph
visph - avatar
+ 1
visph oookay I seee. It's very clear now. It makes a lot of sense. Thanks sooo much buddy 😊😊😊😊😊🤗🤗🤗🤗🤗🤗
6th Feb 2021, 1:23 PM
جوردن آهو ماولی
جوردن آهو ماولی - avatar