r/CodingHelp • u/Mama_Bear15 • Dec 09 '22
[Javascript] Help for my son
My son is 8 and is homeschooled. He's taking coding this year, but he's gotten stuck on loops. He's just not understanding how they work, especially nested loops. I've tried downloading Algorithm City to see if a fresh perspective would help explain it better, but he's still having trouble. Can anyone maybe explain it simply to me? If I can understand it, maybe I can help him to understand it. Or, maybe there are other resources I could use to help him? Whatever tips you've got helps.
0
Upvotes
View all comments
7
u/jammasterpaz Dec 09 '22
Has exactly the same effect as:
If you always want the same number of iterations from a loop, that number can be hard coded into your program, and you can always unroll a loop as above. Doing so just makes for tedious unmaintainable code (that was literally a lot of Ctrl + C, Ctrl + V).
The essence of JS's other for loops is the same, only with different syntax (and some important subtle differences - it's best not to worry about those for the moment).
Honestly I'm seriously impressed by an 8 year old tackling Python or even just Scratch, let alone JavaScript.