Understanding loops and some argument scenarios

Understanding loops and some argument scenarios
0

#1

Recently I’ve been trying to understand loop arguments more thoroughly and so far I think I get that the arguements set up a condition in which to run the loop…ie

While (x < arr.length){
do something;
}

Although I can ‘see’ the condition with an operator…I am puzzling over some other argument uses I have seen that seems to be a state?

While (arr.length){
do something;
}

I feel like this is some simple epiphany lootz just out of reach and I am probably overthinking it…but thought I’d reach out here for some other lens to look at it thru…
Thanks for any insight


#3

Thank you very much!

I wasn’t thinking of the boolean aspect. I was/am a bit stuck up on the idea that it seems like arr.length is somehow redundant?
Kind of like somehow saying var = variable? I’m at a loss how to ask this a better way…is it simply saying
’ while a length for arr exists’ ?

Thanks again for another way to look at it and the links!


#5

At the risk of sounding like a loop without a break…thanks again :slight_smile:

Off to explore the link lootz you shared.
Already loving the X-files approach in the Truthy Falsy Drip of JS.

Out of curiosity, in your experience learning to code have you found a repetition approach helpful in understanding material?
Like…just writing the code over and over just helps someone eventually have the epiphany loot?

I was reading an article yesterday about ‘Mastery’ approach the Chinese use for teaching math…it made me think of the Simpson cartoon with Bart writing a concept 500 times on the blackboard…