Having too many many "For" loop in my code increase complexity to my development, is there a better开发者_开发问答 solution to For loop alternative?
In my code. I have used 50% of the time to loop array.
Well if you have to work on Arrays alot check the reference under Array. They have very usefull functions like Array.every() or Array.forEach() or Array.map().
Maybe one of those is helpful to your concern.
Well, there's for each
and while
, but they're still loops!
Sometimes, looping is just necessary, and there's no way around it. Can you explain more about what you think is wrong with your current code, or perhaps post a code sample?
On the contrary, if you use the same loop style throughout the application, it may make it easier to read for third parties.
精彩评论